pil*_*eem 3 objective-c uitableview ios
在我的应用程序中,我有一个UITableView和它的一个单元格UIButton.这个按钮有一个动作:
- (IBAction)showPopover:(UIButton *)sender
{
ChoseOptionsViewController *contentController = [[ChoseOptionsViewController alloc] init];
contentController.modalPresentationStyle = UIModalPresentationPopover;
UIPopoverPresentationController *copvc = contentController.popoverPresentationController;
copvc.permittedArrowDirections = UIPopoverArrowDirectionAny;
copvc.sourceView = self.view;
copvc.sourceRect = sender.bounds;
contentController.preferredContentSize = CGSizeMake(200, 200);
[self presentViewController:contentController animated:YES completion:nil];
}
Run Code Online (Sandbox Code Playgroud)
问题是没有sender.bounds返回,所以弹出窗口显示在左上角self.view,而不是按钮的一侧.提前致谢.
pba*_*sdf 10
尝试将您更改sourceView为sender:
copvc.sourceView = sender;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2408 次 |
| 最近记录: |