问题描述
- 从UIButton选择器调用方法
-
怎么从按钮选择器中调用方法?有如下代码:
- (void)displayEditorForImage:(UIImage *)imageToEdit { AFPhotoEditorController *editorController = [[AFPhotoEditorController alloc] initWithImage:imageToEdit]; [editorController setDelegate:self]; [self presentViewController:editorController animated:YES completion:nil]; }
UIButton调用的:
//edit button UIButton *editButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [editButton addTarget:self action:@selector(editBtnTouch) forControlEvents:UIControlEventTouchDown]; [editButton setTitle:@"Effects" forState:UIControlStateNormal]; **// the following line shows the selector where I'm unsure how to call the method from the code above** if ([[UIScreen mainScreen] respondsToSelector:@selector(displayEditorForImage:)] && ([UIScreen mainScreen].scale == 2.0)) { // Retina display editButton.frame = CGRectMake(220.0, 320.0, 60.0, 40.0); } else { editButton.frame = CGRectMake(220.0, 315.0, 60.0, 40.0); } [self.view addSubview:editButton];
解决方案
层次有点乱。你这个editButton是在哪个控制器下, editorController ? 又要干些什么事,描述的不太清楚。问题再补充一下。
时间: 2024-11-08 19:16:14