1
我由follwing代碼採摘從iphone的圖像:攝取的圖像保存原因放緩
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[self dismissViewControllerAnimated:YES completion:nil];
UIImage *pickedImg = (UIImage*)[info objectForKey:UIImagePickerControllerOriginalImage];
[self.photoBtn setBackgroundImage:pickedImg forState:UIControlStateNormal];
[[self.tblView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]].contentView addSubview:photoBtn];
data.img = pickedImg;
//data.img = nil;
[self.tblView reloadData];
}
然後這段代碼保存:
-(void)saveProfile {
data.firstName = firstName.text;
data.lastName = lastName.text;
data.phoneMob = phoneMob.text;
data.phoneHome = phoneHome.text;
data.emailOffice = emailOff.text;
data.emailPersonal = emailPers.text;
data.address = address.text;
data.company = company.text;
data.website = website.text;
//NSLog(data.img);
NSMutableData *pData = [[NSMutableData alloc]init];
NSString *path = [common saveFilePath];
NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc]initForWritingWithMutableData:pData];
[data encodeWithCoder:archiver];
[archiver finishEncoding];
[pData writeToFile:path atomically:YES];
[self.navigationController popViewControllerAnimated:YES];
}
但是,當我試圖保存配置文件,它導致放緩。 然後我在第一種方法中嘗試data.img = nil
。現在它可以不用緩慢地保存圖像。我怎樣才能將圖像保存起來?
thx。但它與 - [CALayer phoneMob]:無法識別的選擇器發送到實例崩潰 – manujmv