1

私のキャリアの奇妙な瞬間に直面します。私はUIViewControllerにいくつかのuitextfieldと1つのuitextviewを持っています....すべてがシミュレータとiPhone 4のiOS v 4.3.5上で正常に動作します。しかし、iPhone 4のiOS v 4.0.1では時々全体像がリフレッシュされます。それは時々私のuitextfieldsを意味した& uitextviewカメラから画像を選んだ後にテキストを失った.....iPhoneデバイスからカメラから画像を取得すると、UITextViewとUITextFieldが更新されます

この私の試みを解決するためのビューが消えたときに私はいくつかの配列.....に値を保存.....配列の値をテキストボックスに.....それはシミュレータでもうまく動作します。今回はiPhone 4のiOS v 4.0.1でアプリが動かなくなりました。

- (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { 
    NSLog(@"title : %@",actionSheet.title); 
    if (![actionSheet.title isEqualToString:@"Success"] && ![actionSheet.title isEqualToString:@"Error"] && ![actionSheet.title isEqualToString:@"خطأ"]) { 
     if(buttonIndex == 1) { 
      if([UIImagePickerController isSourceTypeAvailable: 
       UIImagePickerControllerSourceTypePhotoLibrary]) 
      { 
       UIImagePickerController *picker= [[UIImagePickerController alloc]init]; 
       picker.delegate = self; 
       picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
       [self presentModalViewController:picker animated:YES]; 
       [picker release]; 
      } 
     } else { 
      UIImagePickerController *picker = [[UIImagePickerController alloc] init]; 
      picker.delegate = self; 
      picker.allowsImageEditing = YES; 
      picker.sourceType = UIImagePickerControllerSourceTypeCamera; 
      [self presentModalViewController: picker animated:YES]; 
      [picker release]; 
     } 
    } 
} 

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)editInfo { 

    float actualHeight = img.size.height; 
    float actualWidth = img.size.width; 
    float imgRatio = actualWidth/actualHeight; 
    float maxRatio = 320.0/480.0; 

    if(imgRatio!=maxRatio){ 
     if(imgRatio < maxRatio){ 
      imgRatio = 480.0/actualHeight; 
      actualWidth = imgRatio * actualWidth; 
      actualHeight = 480.0; 
     } 
     else{ 
      imgRatio = 320.0/actualWidth; 
      actualHeight = imgRatio * actualHeight; 
      actualWidth = 320.0; 
     } 
    } 
    CGRect rect = CGRectMake(0.0, 0.0, actualWidth, actualHeight); 
    UIGraphicsBeginImageContext(rect.size); 
    [img drawInRect:rect]; 
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); 
    UIGraphicsEndImageContext(); 

    if(imageCount == 1){ 
     self.firstImage = image; 
     self.previewImage1.image =firstImage; 
    }else if(imageCount == 2){ 
     self.secondImage = image; 
     self.previewImage2.image =secondImage; 
    }else if(imageCount == 3){ 
     self.thirdImage = image; 
     self.previewImage3.image =thirdImage; 
    }else if(imageCount == 4){ 
     self.fourthImage = image; 
     self.previewImage4.image =fourthImage; 
    } 
    [myImageNames replaceObjectAtIndex:imageCount-1 withObject:@"Assigned"]; 

    [[picker parentViewController] dismissModalViewControllerAnimated:YES]; 
} 
+0

問題があるコードを貼り付けてください。 – WrightsCS

+0

「私のアプリが詰まっている」とはどういう意味ですか?アプリケーションインターフェイスがフリーズし、2〜3秒間タッチしても反応せず、正常に動作し続けることを意味しますか? –

+0

ちょっと気にしていないことを無視しています...私はiPhone 4のiOS v4.0.1でカメラから画像を選んだ直後に、時々(私はいつも)私のuitextfieldを空白にしますが、シミュレータとiPhone 4 IOSv 4.3.5では –

答えて

1

解決済み...デバイスから削除されたアプリ。デバイスを再起動してビルドをやり直してください.... カメラから画像を取り込む際に、uitextfieldの更新に問題はありません。 寒い人たち.... :-)

関連する問題