【发布时间】:2015-07-30 12:46:30
【问题描述】:
我正在尝试显示来自 .xib 的视图控制器,该控制器向用户指示应用程序的更新可用。出于某种原因,以下代码似乎什么都不做:
if ([serverObject[@"newServerBuilt"] isEqualToString:@"YES"]) {
//we want to display the text from the server to user
NSString * displayText=serverObject[@"displayText"];
ForceUpdate * forceUpdateViewController = [[ForceUpdate alloc] initWithNibName:@"ForceUpdate" bundle:nil];
forceUpdateViewController.textToShow=displayText;
[self presentViewController:forceUpdateViewController animated:NO completion:nil];
}
有人知道为什么吗?如您所见,我允许自己根据服务器上的可自定义消息显示更新视图控制器。
另外,当我点击 .xib 中的文本标签时,它说文本标签连接到“文件的所有者”,但它应该连接到“强制更新”吗?
强制 update.h 看起来像这样:
#import <UIKit/UIKit.h>
@interface ForceUpdate : UIView
@property (nonatomic, strong) NSString * textToShow;
@end
【问题讨论】:
标签: objective-c uiview uiviewcontroller xib