Unverified Commit 609d30fe authored by Roger's avatar Roger Committed by GitHub

bind missing add icon in platform_view example (#132028)

In the `examples/platform_view` example, which demonstrates
transitioning from a Flutter view to a general iOS UIView and back, as
well as using channels to communicate between the two, the Flutter view
renders correctly, but in the iOS UIView, the FAB equivalent button in
the lower-right corner is rendered without the '+' icon. This is because
no binding as declared for the add icon in the storyboard. This adds the
missing binding.

Further, this eliminates the use of the deprecated
[UIButtonTypeRoundedRect](https://developer.apple.com/documentation/uikit/uibuttontype/uibuttontyperoundedrect?language=objc),
falling back to the default instead.

---------
Co-authored-by: 's avatarChris Bracken <chris@bracken.jp>
parent c353cb01
......@@ -27,8 +27,6 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
......@@ -38,8 +36,19 @@
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3B2B2F762B8D199B000AFD7A"
BuildableName = "RunnerTests.xctest"
BlueprintName = "RunnerTests"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
......@@ -61,8 +70,6 @@
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Profile"
......
......@@ -49,7 +49,7 @@
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="K7X-Ru-0N7" customClass="MDButton">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="K7X-Ru-0N7">
<rect key="frame" x="94" y="325.5" width="188" height="38"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
......@@ -86,7 +86,7 @@
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6yL-sX-bUL" customClass="MDButton">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6yL-sX-bUL">
<rect key="frame" x="300" y="-5" width="55" height="55"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
......@@ -94,6 +94,7 @@
<constraint firstAttribute="height" constant="55" id="q45-t3-9DA"/>
</constraints>
<color key="tintColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<state key="normal" image="ic_add.png"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="type">
<integer key="value" value="2"/>
......@@ -129,6 +130,7 @@
</view>
<connections>
<outlet property="incrementLabel" destination="qaB-rs-mWp" id="bFY-of-WoI"/>
<outlet property="incrementButton" destination="6yL-sX-bUL" id="aQR-ap-BrT"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="7qW-nP-WZA" userLabel="First Responder" sceneMemberID="firstResponder"/>
......
......@@ -8,8 +8,8 @@
- (void)didUpdateCounter:(int)counter;
@end
@interface PlatformViewController : UIViewController
@property (strong, nonatomic) id<PlatformViewControllerDelegate> delegate;
@property(weak, nonatomic) IBOutlet UIButton* incrementButton;
@property(strong, nonatomic) id<PlatformViewControllerDelegate> delegate;
@property int counter;
@end
......@@ -2,11 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import <Foundation/Foundation.h>
#import "PlatformViewController.h"
#import <Foundation/Foundation.h>
@interface PlatformViewController ()
@property (weak, nonatomic) IBOutlet UILabel *incrementLabel;
@property(weak, nonatomic) IBOutlet UILabel* incrementLabel;
@end
@implementation PlatformViewController
......@@ -27,9 +28,8 @@
}
- (void)setIncrementLabelText {
NSString* text = [NSString stringWithFormat:@"Button tapped %d %@.",
self.counter,
(self.counter == 1) ? @"time" : @"times"];
NSString* text = [NSString stringWithFormat:@"Button tapped %d %@.", self.counter,
(self.counter == 1) ? @"time" : @"times"];
self.incrementLabel.text = text;
}
......
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import <Foundation/Foundation.h>
#import <XCTest/XCTest.h>
#import "PlatformViewController.h"
@interface PlatformViewControllerTests : XCTestCase
@property (nonatomic, strong) XCUIApplication *app;
@end
@implementation PlatformViewControllerTests
- (void)setUp {
// Put setup code here.
// This method is called before the invocation of each test method in the class.
}
- (void)tearDown {
// Put teardown code here.
// This method is called after the invocation of each test method in the class.
}
- (void)testViewControllerIconLoaded {
UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
PlatformViewController* controller = [storyboard instantiateViewControllerWithIdentifier:@"PlatformView"];
XCTAssertNotNil(controller);
[controller loadViewIfNeeded];
UIImage* incrementButtonIcon = [controller.incrementButton imageForState:UIControlStateNormal];
XCTAssertNotNil(incrementButtonIcon);
}
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment