在尝试从popover显示UIActionSheet时,是否有人收到此消息?
您的应用程序提供了样式UIAlertControllerStyleActionSheet的UIAlertController().具有此样式的UIAlertController的modalPresentationStyle是UIModalPresentationPopover.您必须通过警报控制器的popoverPresentationController为此弹出窗口提供位置信息.您必须提供sourceView和sourceRect或barButtonItem.如果在显示警报控制器时未知此信息,则可以在UIPopoverPresentationControllerDelegate方法-prepareForPopoverPresentation中提供该信息.
在GM之前,我使用了一些解决方法将UIActionSheet转换为UIAlertController,这很好用.然而,似乎Apple试图解决UIActionSheet问题,我不想使用我的解决方法 - 但似乎我别无选择......
uiactionsheet uipopovercontroller ios ios8 uialertcontroller
我有以下代码来显示没有箭头的popoverview(对话框),它工作正常.唯一的问题是,对话框显示在左上角(IPad).我想将视图置于屏幕中心.
在我的下面的代码中要更改或添加什么?:
func show_help(){
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let controller = storyboard.instantiateViewControllerWithIdentifier("Help") as! UIViewController
controller.modalPresentationStyle = UIModalPresentationStyle.popover
let popoverPresentationController = controller.popoverPresentationController
// result is an optional (but should not be nil if modalPresentationStyle is popover)
if let _popoverPresentationController = popoverPresentationController {
// set the view from which to pop up
_popoverPresentationController.sourceView = self.view;
_popoverPresentationController.permittedArrowDirections = UIPopoverArrowDirection.allZeros;
// present (id iPhone it is a modal automatic full screen)
self.presentViewController(controller, animated: true, completion: nil)
}
}
Run Code Online (Sandbox Code Playgroud)
额外的信息
在我的视图中,链接到我的viewcontroller我设置了这样的优先大小:
override …Run Code Online (Sandbox Code Playgroud) 我需要为我的iPhone应用程序使用UIPopOverController,我搜索stackoverflow有人说UIPopoverController不能在iphone设备上运行为什么?.当我在iphone设备上运行时我得到了这个错误 reason: '-[UIPopoverController initWithContentViewController:]
called when not running under UIUserInterfaceIdiomPad.'
-(void)btnSetRemainderTapped:(UIButton *)button
{
setReminderView =[[SetRemainderView alloc]initWithNibName:@"SetRemainderView" bundle:[NSBundle mainBundle]];
setReminderView.contentSizeForViewInPopover = CGSizeMake(setReminderView.view.frame.size.width, setReminderView.view.frame.size.height);
setReminderView.delegate = self;
popOverController = [[UIPopoverController alloc]
initWithContentViewController:setReminderView] ;
CGRect rect = CGRectMake(self.view.frame.size.width/2, self.view.frame.size.height/2, 1, 1);
[popOverController presentPopoverFromRect:rect
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
}
Run Code Online (Sandbox Code Playgroud)
谁能帮我?
我有一个适用于iPhone和iPad的应用程序,当我尝试加载UIPickerViewController一个UIPopoverController用于iPad,我得到了异常"源类型1不可用".即使使用该设备也会出现问题.
@try {
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.delegate = self;
imagePicker.allowsEditing = NO;
self.tempComp = component;
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
[self presentModalViewController:imagePicker animated:YES];
}else {
// We are using an iPad
popoverController=[[UIPopoverController alloc] initWithContentViewController:imagePicker];
popoverController.delegate = self;
[popoverController presentPopoverFromRect:component.bounds inView:component permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
}else{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Camera Non Disponibile" message:@"La camera non è disponibile" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles: nil];
[alert show];
} …Run Code Online (Sandbox Code Playgroud) uipickerview uipickerviewcontroller ipad uipopovercontroller ios
我正在使用iPad应用程序而我正在使用UIPopoverControllers.我正在应用程序需要品牌和样式的部分,我想知道如何更改UIPopoverController的颜色/色调?标准是深蓝色,但它需要是另一种颜色..
这可能吗?
招呼,托马斯
我总是尝试以这种方式从tableView中的单元格呈现一个popover:
[myPopover presentPopoverFromRect:cell.frame inView:self.tableView permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
Run Code Online (Sandbox Code Playgroud)
但是我不能使用UIPopoverArrowDirectionRight或Left,因为根据ipad(纵向或横向)的位置,popover会出现在其他地方.
我是以正确的方式呈现弹出窗口吗?
PS:表视图位于splitView的detailView中.
我正在使用Xcode 6开发iOS应用程序.
当我使用时UIAlertController,它可以在iPhone 6模拟器上运行良好,但在iPad模拟器上崩溃.
单击"共享"时出现问题,然后可能会崩溃.我该怎么解决?
这是我的代码:
override func tableView(tableView: UITableView, editActionsForRowAtIndexPath indexPath: NSIndexPath) -> [AnyObject] {
var shareAction = UITableViewRowAction(style: UITableViewRowActionStyle.Default, title: "Share", handler: { (action:UITableViewRowAction!, indexPath:NSIndexPath!) -> Void in
let shareMenu = UIAlertController(title: nil, message: "Share using", preferredStyle: .ActionSheet)
let twitterAction = UIAlertAction(title: "Twitter", style: UIAlertActionStyle.Default, handler: nil)
let facebookAction = UIAlertAction(title: "Facebook", style: UIAlertActionStyle.Default, handler: nil)
let emailAction = UIAlertAction(title: "Email", style: UIAlertActionStyle.Default, handler: nil)
let cancelAction = UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Cancel, handler: nil)
shareMenu.addAction(twitterAction)
shareMenu.addAction(facebookAction) …Run Code Online (Sandbox Code Playgroud) 当用户触摸动态TableView中的单元格时,我需要执行Popover segue.但是,当我尝试使用此代码执行此操作时:
- (void)tableView:(UITableView *)tableview didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self performSegueWithIdentifier:@"toThePopover" sender:[tableView cellForRowAtIndexPath]];
//...
}
Run Code Online (Sandbox Code Playgroud)
比我得到一个错误:
非法配置
Popover segue没有锚
有没有办法做到这一点(手动从动态TableView执行popover segue)?
我想实现UIVisualEffectView将模糊效果应用于视图以显示其背后的视图.
这个应该有背景模糊的视图UITableViewController是嵌入在a中的UINavigationController,它将在iPad上以popover呈现,或者它将在iPhone上以模式全屏显示,这要归功于iOS 8自适应segues(Present as Popover).当这个视图控制器在弹出框中时,我希望背景模糊弹出框下面的内容,当它全屏显示时,我希望背景模糊前一个视图控制器.
我试图实现这个并且没有成功.我甚至无法使模糊效果适用于弹出窗口.我认为这段代码可以解决问题:
//In viewDidLoad on the UITableViewController subclass:
let effectView = UIVisualEffectView(effect: UIBlurEffect(style: .Light))
effectView.frame = tableView.frame
tableView.addSubview(effectView)
Run Code Online (Sandbox Code Playgroud)
我也尝试添加子视图tableView.backgroundView,我尝试设置backgroundView为我effectView,我尝试使用Autolayout约束而不是设置框架,但没有任何工作.你能帮助我完成所期望的行为吗?
我想要获得的一个例子:
iPad popover:

iPhone模态演示:

uitableview uipopovercontroller modalviewcontroller ios swift
ios ×6
ipad ×5
objective-c ×3
iphone ×2
popover ×2
swift ×2
coding-style ×1
ios8 ×1
modal-dialog ×1
segue ×1
uialertsheet ×1
uipickerview ×1
uitableview ×1