我试图UIActionSheet在iPad上显示一个内置的UIPickerView,我有相同的代码适用于iPhone,所以我的UIPickerView代理和数据源的东西工作,但在我使用-[UIActionSheet showFromRect:inView:animated:]结果的iPad上UIPopover/ UIActionSheet太小,我似乎无法设置帧大小,也不显示任何按钮.
我不知道这是因为它们是在界外还是还有其他事情发生.这是我删除所有非必要代码(iPhone等)后代码的样子.有人知道我做错了什么,有没有人知道任何例子.
CGRect thePickerFrame = CGRectMake(0, 0, 320.0, 485.0);
UIPickerView * thePickerView = [[UIPickerView alloc] initWithFrame:thePickerFrame];
[pickerActionSheet release], pickerActionSheet =
[[UIActionSheet alloc] initWithTitle:@"Choose" delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Next", nil];
thePickerView.showsSelectionIndicator = YES;
thePickerView.dataSource = self;
thePickerView.delegate = self;
[pickerActionSheet addSubview:thePickerView];
[thePickerView selectRow:0 inComponent:0 animated:NO];
[thePickerView release];
[pickerActionSheet showFromRect:currentTextField.bounds
inView:currentTextField animated:NO];
pickerActionSheet.frame = thePickerFrame;
Run Code Online (Sandbox Code Playgroud) 有没有办法确定一个类是否适合作为键并且将按预期工作,例如我想在NSDictionary中使用NSIndexPath作为键,但我不确定两个不同的NSIndexPath实例是否具有相同的整数值将始终返回相同的哈希值.
在__attribute __((构造函数))函数中使用自己项目中定义的类是否安全?当调用__attribute __((构造函数)函数时,Objective-C运行时是否有机会对类执行所需操作?或者我是否误解了运行时如何加载类,并且在此上下文中库类和您自己的类之间没有区别?