【发布时间】:2016-05-24 14:54:22
【问题描述】:
当从一个视图控制器单击按钮时,我尝试设置第二个视图控制器的 NSString 属性
CommentsViewController *commentViewController = [[CommentsViewController alloc] init];
STPopupController *commentPopupController = [[STPopupController alloc] initWithRootViewController:commentViewController];
commentPopupController.containerView.layer.cornerRadius = 4;
commentViewController.streamID = trackID;
commentViewController.radioID = radioID;
[commentPopupController presentInViewController:self];
但是当视图控制器显示为弹出窗口时,这些字符串值为空。我怎么了?
@property (strong, nonatomic) NSString *streamID;
@property (strong, nonatomic) NSString *radioID;
是视图控制器启动了两次还是什么,我找不到问题所在。 这是评论视图控制器的init方法
- (instancetype)init {
if (self == [super init]) {
self.title = @"Comments";
self.navigationController.navigationBar.tintColor = [UIColor blueColor];
self.contentSizeInPopup = CGSizeMake(self.view.frame.size.width - 50 , self.view.frame.size.height - 150);
// self.landscapeContentSizeInPopup = CGSizeMake(400, 200);
}
return self;
}
【问题讨论】:
-
这里为什么要设置commentViewController为rootViewController?
-
为什么没有使用appdelegate didFininishLaunchWithOptions中的代码?
-
这是另一个故事板中应用程序的另一个部分
-
你使用两个故事板吗?
-
一个,但应用程序的启动部分是由其他人使用 xib 文件完成的
标签: ios objective-c