@interface HuntProfileView : UIViewController
@property (strong, nonatomic) NSString *huntgroupTitle;
@property (strong, nonatomic) NSString *huntgroupId;
@property (strong, nonatomic) NSArray *lines;
@end
@interface HuntProfileView ()
@property (weak, nonatomic) IBOutlet UITextField *huntgrouptitleText;
@property HuntLineTable *childView;
@end
@implementation HuntProfileView
- (void)viewDidLoad {
[super viewDidLoad];
NSLog(@"huntgroupTitle %@", self.huntgroupTitle);
self.huntgrouptitleText.text = self.huntgroupTitle;
}
^{
HuntProfileView *viewController = [self.storyboard instantiateViewControllerWithIdentifier:@"HUNTVIEW"];
viewController.huntgroupId = huntId;
viewController.huntgroupTitle = title;
[self.navigationController pushViewController:viewController animated:YES];
}
viewController.huntgroupTitle = title;
is correct, or at least title is the string as expected.
The NSLog in .m
outputs as:
2015-01-21 09:47:42.267 changeView[1108:16196] huntgroupTitle <UITextField: 0x7fa9a8fc8480; frame = (16 63; 568 30); text = ''; clipsToBounds = YES; opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x7fa9a8fc9c70>>
2015-01-21 09:47:42.267 changeView[1108:16196] -[UITextField rangeOfCharacterFromSet:]: unrecognized selector sent to instance 0x7fa9a8fc8480
2015-01-21 09:47:42.270 changeView[1108:16196] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITextField rangeOfCharacterFromSet:]: unrecognized selector sent to instance 0x7fa9a8fc8480'
I'm able to get successful execution when assigning self.huntgroupTitle
a literal string ("hello, world"). Debugging has shown that at instantiation, both the input string of title
as well as viewController.huntgroupTitle
are confirmed to be the correct type.
While initialising the HuntProfileView
you must be assigning a UITextField
to huntgroupTitle
. Please check that.
I guess you might be doing something like this
HuntProfileView *huntV = [[HuntProfileView alloc] init];
huntV.huntgroupTitle = **some UITextField**;
instead it should be
HuntProfileView *huntV = [[HuntProfileView alloc] init];
huntV.huntgroupTitle = someTextField.text;
Please check. Thanks
The Storyboard source file had:
<connections>
<outlet property="huntgroupTitle" destination="wx0-NH-iGn" id="P9H-Oe-AEm"/>
<outlet property="huntgrouptitleText" destination="wx0-NH-iGn" id="Z1E-9e-lEn"/>
</connections>
Removing line with property "huntgroupTitle"
resolved this
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.