这是我如何显示UIAlertView和委托clickedButtonAtIndex -
UIAlertView *alert =
[[UIAlertView alloc] initWithTitle: @"title"
message: @"message"
delegate: self
cancelButtonTitle: @"Cancel"
otherButtonTitles: @"Continue", nil];
[alert show];
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
//something
}
Run Code Online (Sandbox Code Playgroud)
这段代码在没有ARC的情况下完美运行.但是使用ARC它会抛出此错误 - 由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:' - [__ NSCFType alertView:clickedButtonAtIndex:]:无法识别的选择器发送到实例0x859d790'
关于代表为何抛出此错误的任何想法?
我有一个UIWindow对象,我想在故事板上显示.我这样做了 -
UIWindow *webWindow = [[UIWindow alloc] initWithFrame:CGRectMake(0, 20, 320,480)];
webWindow.windowLevel = UIWindowLevelAlert;
Run Code Online (Sandbox Code Playgroud)
我这样做是keyAndVisible -
[webWindow makeKeyAndVisible];
Run Code Online (Sandbox Code Playgroud)
问题是它不可见.我试过NSLog看到所有的Windows,它显示了这样的东西 -
Windows:(
"<UIWindow: 0x9b5cf20; frame = (0 0; 320 480); layer = <UIWindowLayer: 0x9b61400>>",
"<UIWindow: 0x9846880; frame = (0 0; 320 480); layer = <UIWindowLayer: 0x9846a60>>"
)
Run Code Online (Sandbox Code Playgroud)
我在这里阅读了一些关于如何使用Storyboard的窗口 - http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/doc/uid/TP40006786 -CH 3-SW30
但目前尚不清楚如何使用它在Storyboard上显示一个窗口.