【发布时间】:2011-05-27 12:09:13
【问题描述】:
在我的应用程序的一个视图中,它是 UIView 类的子类,我在工具栏(self.navigationController.toolBar)上有一个按钮。按下后,UIActionSheet 会弹出“删除”和“取消”。
myView.h
NSString *classVariable;
....
@property (nonatomic, retain) NSString *classVariable;
myView.m
@synthesize classVariable,...;
-(void) viewDidLoad {
...
classVariable = [[NSString alloc] initWithString:@"blah"];
}
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0) {
...
NSLog(classVariable);//BUG HERE!! just cannot printout and app gets sudden death.
}
}
-(void)dealloc{
...
[classVariable release];
}
我不知道为什么我无法从 UIActionSheetDelegate 方法访问变量。我已经声明了变量并给出了值。
谢谢
【问题讨论】:
标签: iphone objective-c delegates uiactionsheet