Assigning to id<UINavigationControllerDelegate,UIImagePickerControllerDelegate> from incompatible type CameraViewController* 警告显示近picker.delegate = self;线
-(IBAction) getPhoto:(id) sender {
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
if((UIButton *) sender == takePhoto) {
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
} else {
//picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
}
[self presentModalViewController:picker animated:YES];
Run Code Online (Sandbox Code Playgroud)
}
有什么区别:
[[NSMutableArray alloc] init]
Run Code Online (Sandbox Code Playgroud)
和
[NSMutableArray array]
Run Code Online (Sandbox Code Playgroud) 本地声明隐藏"self.treatmentId = treatmentId;"附近的实例变量消息弹出窗口 和"self.treatmentName = treatmentName;";
@implementation Treatment
@synthesize treatmentId;
@synthesize treatmentName;
-(Treatment *)initWithtreatmentName:(NSString *)treatmentName treatmentId:(NSString *)treatmentId{
if((self = [super init])){
self.treatmentId = treatmentId;
self.treatmentName = treatmentName;
}
return self;
}
@end
Run Code Online (Sandbox Code Playgroud) 从不兼容类型''CameraVIewController*''中分配id,显示在下面的代码中
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
Run Code Online (Sandbox Code Playgroud) setText是不推荐使用的警告消息UITableViewCell
[cell setText:animal.name];
Run Code Online (Sandbox Code Playgroud)
编译时 但程序运行正常.
有时我在objective-c中看到了这种类型的编码.为什么在释放后将_imageView设置为nil.
- (void)dealloc {
[_imageView release];
_imageView = nil;
[super dealloc];
}
Run Code Online (Sandbox Code Playgroud)