Friday 15 May 2015

iphone - Problem with uibutton in UItableViewCell -


In my application, I am using a customized table, each cell has a rubbish and uiimage. When a touch-up button is indicated, I want to call the IIMAgpController method to select a photo from the iPhone Library and display it in the image view. I wrote it but got a warning ... 'custom cell' presentmodalviewcontroller can not answer animated ... Here Kstmsel My main class subclasses my app, also named nib custom cell. Anyone knows this issue ???? Thank you ...

Edit

  - (IBAction) selectExistingPicture1 {if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypePhotoLibrary]) {UIImagePickerController * picker = [[UIImagePickerController alloc] init]; Picker.delegate = self; Picker.allowsImageEditing = Yes; Picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; [Self current model visual controller: animated picker: yes]; [Picker release]; } Else {UIAlertView * alert = [[UIAlertView alloc] initWithTitle: @ message "Error Accessing Photo Library": @ representatives "device does not support the Photo Library" CancelButtonTitle zero: "Drat" @ OtherButtonTitles: nil]; [Alerts show]; [Warning issued]; }} - (void) imagePickerController: (UIImagePickerController *) picker didFinishPickingImage: (UIImage *) image editingInfo: (NSDictionary *) editingInfo {CGSize newSize = CGSizeMake (80, 80); UIGRIFIiBIGIJJC Contex (NUCIES); [Image DrawRector: CGRactMake (0,0, new size.width, new size. Hi)]; UIImage * newImage = UIGraphicsGetImageFromCurrentImageContext (); UIGraphicsEndImageContext (); ImageView.image = newImage; [Picker Dismmandmodl Vij Niyntrkanumti: YES]; // warnings are shown here}  

This is a custom cell class .. and viewController is in the class ...

  - (UITableViewCell *) Table view : (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath {static NSString * CustomCellIdentifier = @ "CustomCellIdentifier"; Customcell * cell = (customcell *) [TableViewRequiredCalViewidentifier: customsendifier]; If (cell == zero) {NSArray * nib = [[NSBundle mainBundle] loadNib nominated: @ "customcell" owner: zero option: zero]; (Id current object niB) {if ([currentObject isKindOfClass: [CustomCell class]]) {cell = (CustomCell *) currentObject; break; }}} NSUInteger s = indexPath.section; // [cell settext: [NSString stringWithFormat: @ "I have cell% d", indexPath.row]]; NSUnitor R = IndexPath.ro; Cell.imageView.image = Zero; For (S; == 0; s ++) (R; R == 0; R ++) {UIImage * img = imageView.image; Cell.imageView.image = img; } Return cell; }    

UITableViewCell gives no response -presentModalViewController : Animated:

You might give your CustomCell pointer to your views controller, and then -presentModelViewController Phone:. Animated: on view controller.

Add an example variable to your custom cell class:

  @interface customcell: UITableViewCell {UIViewController * viewController; } @protecti (nanatomic, assign) UIViewController * viewController; @end  

In the -tableView: cellForRowAtIndexPath: , after you create a new CustomCell, set the property:

  if ( Cell == zero) {NSArray * nib = [[NSBundle mainBundle] loadNibNamed: @ "customcell" owner: zero option: zero]; (Id current object niB) {if ([currentObject isKindOfClass: [CustomCell class]]) {cell = (CustomCell *) currentObject; Cell.viewController = self; // & lt; - Add this break; }}}  

Then, in your customcell class

  [Self current model view controller: animated picker: yes];  

with

  [self.viewController presentModalViewController: animated picker: yes];  

No comments:

Post a Comment