我处于一种情况,我需要从基于选项卡的应用程序开始,并且我需要一个或多个选项卡的拆分视图.但似乎拆分视图控制器对象无法添加到tabbarController中.(虽然tabbar对象可以添加到splitviewcontroller).
问题还可以看出:我在左侧部分有一个完整的屏幕我有一个表视图,当在表中选择任何行时,弹出框应该指向该行.现在,当弹出窗口中的任何行被选中时,此弹出窗口中的行将位于所选行的左下方(仅此行可见),而另一个弹出窗口将从所选行中出现.(面包屑导航类型)
我想我清楚地解释了什么.那么有任何想法或解决方法吗?
如果我不清楚我的问题,请告诉我.
谢谢,
Madhup
uitabbarcontroller ipad uisplitviewcontroller iphone-sdk-3.2 uipopovercontroller
我有一个UIViewController包含一个UITableView.这UIViewController是在一个显示UIPopoverController.
现在,事情是,物品的数量tableView不是恒定的,我想要弹出的大小(即 - popoverContentSize),根据物品的数量进行调整tableView
天真,我在想,如果我将设置contentSizeForViewInPopover在viewDidLoad我加载后,tableView所有的项目-它会做到这一点.
它没有.
所以简而言之,我的问题是:如何popoverContentSize直接改变contentViewController- 在它被呈现之后?
附录:

如果你想解雇一个弹出窗口 - 例如,从popover的contentViewController中的一个按钮你必须 -
dismissPopover:animated通知或委托方法时调用同时,UIViewController您可以访问模态视图控制器,父视图控制器,导航控制器,拆分视图控制器,标签栏控制器,搜索显示控制器,子视图控制器,呈现视图控制器和呈现的视图控制器.
从popover的contentViewController有更好的方法吗?
我在UIPopoverController中使用UIImagePickerController,它与iOS6完美配合.使用iOS 7时,显示捕获图像的"预览"图像会旋转,但如果我拍照,则会正确保存.
这就是我选择的方式:
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.mediaTypes = [NSArray arrayWithObjects:
(NSString *) kUTTypeImage,
nil];
imagePicker.allowsEditing = NO;
Run Code Online (Sandbox Code Playgroud)
并将其添加到弹出控制器:
self.imagePickerPopOver = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
[self.imagePickerPopOver presentPopoverFromRect:CGRectMake(aPosViewA.x, cameraButton_y, 100.0, 30.0) inView:self.detailViewController.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
Run Code Online (Sandbox Code Playgroud)
这些是UIScrollView上按钮位置的计算,以显示正确位置的弹出窗口:
presentPopoverFromRect:CGRectMake(aPosViewA.x, cameraButton_y, 100.0, 30.0)
Run Code Online (Sandbox Code Playgroud)
我不认为问题就在那里,因为我尝试了几种组合.
我还尝试在全屏模式下捕获图像,但应用程序只允许使用横向模式.如果以纵向模式拍摄图像并且取消模态视图,则应用程序也将保持纵向模式.如果模态视图被解除,我找不到阻止UIImagePickerController切换到纵向模式或强制应用程序回到横向模式的方法.
UPDATE
我从这里得到了答案,又向前迈进了一步.
我在创建选择器之后和显示弹出窗口之前转换视图:
switch ([UIApplication sharedApplication].statusBarOrientation) {
case UIInterfaceOrientationLandscapeLeft:
self.imagePicker.view.transform = CGAffineTransformMakeRotation(M_PI/2);
break;
case UIInterfaceOrientationLandscapeRight:
self.imagePicker.view.transform = CGAffineTransformMakeRotation(-M_PI/2);
break;
default:
break;
}
Run Code Online (Sandbox Code Playgroud)
只要我不转动iPad,它就能正常工作.为此,我正在注册方向更改事件:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil];
Run Code Online (Sandbox Code Playgroud)
并更改选择器视图:
- …Run Code Online (Sandbox Code Playgroud) uiimagepickercontroller uipopovercontroller uiinterfaceorientation ios ios7
我确信这里有一些显而易见的东西,但我知道popover控件可以有"titles",一个标题区域,在内容视图上方有一行文本(例如iWork中的"Tools"弹出窗口).
如何在我自己的popovers中添加它?
谢谢.
旋转后我无法在屏幕上保持弹出相同的位置.有没有什么好方法可以做到这一点,因为只是设置一些框架到弹出窗口旋转后工作很糟糕.popover.frame = CGRectMake(someFrame);旋转弹出后,只有当它位于屏幕的中心时才会看起来很好.
使用iOS我现在有15个ViewControllers我想从一个ViewController弹出到另一个View Controller.
我正在使用此代码:
SecondViewController *Sec=[SecondViewController alloc]init];
[self.navigationController popViewController:Sec animated:YES];
Run Code Online (Sandbox Code Playgroud)
这显示错误this ViewController not exist,然后我使用此代码:
NSArray *array = [self.navigationController viewControllers];
[self.navigationController popToViewController:[array objectAtIndex:1] animated:YES];
Run Code Online (Sandbox Code Playgroud)
此代码适用于从thirdViewController弹出到secondViewController.但是当我们从第九个(第9个)ViewController弹出到第五个(第五个)ViewController然后我在第九个(第9个)ViewController中使用这个代码时发生了什么:
NSArray *array = [self.navigationController viewControllers];
[self.navigationController popToViewController:[array objectAtIndex:4] animated:YES];
Run Code Online (Sandbox Code Playgroud)
它不会从Ninth(第9个)ViewController弹出到第五个(第五个)ViewController,它将第九个(第9个)ViewController弹出到第八个(第8个)ViewController.我不知道当我们使用这条线时发生了什么:
NSArray *array = [self.navigationController viewControllers];
NsLog(@"array = %@",array);
Run Code Online (Sandbox Code Playgroud)
当我们使用它时Ninth(9th)ViewController.NsLog显示:
array= First(1st)ViewController;
Second(2nd)ViewController;
Eight(8th)ViewController;
Ninth(9th)ViewController;
Run Code Online (Sandbox Code Playgroud)
我不知道为什么只有四个视图控制器显示.每当我使用15个视图控制器时.每个视图控制器中都会出现此问题.例如,如果我使用pop形式第十五(15)ViewController到Fifth(5th)ViewController然后相同的问题清单.
NSArray *array = [self.navigationController viewControllers];
NsLog(@"array = %@",array);
array= First(1st)ViewController;
Second(2nd)ViewController;
fourteenth(14th)ViewController;
fifteenth(15th)ViewController;
Run Code Online (Sandbox Code Playgroud)
我想计算ViewControllers的数量,然后弹出到特定的ViewController.
iphone objective-c uinavigationcontroller uipopovercontroller ios
我正在使用UIAlertController.但是在iOS 8的iPad上,actionSheet显示了弹出式箭头.任何隐藏箭头的想法?
这是我的代码:
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"this is alert controller" message:@"yeah" preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction *cancelAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"Cancel", @"Cancel action")
style:UIAlertActionStyleCancel
handler:^(UIAlertAction *action)
{
NSLog(@"Cancel action");
}];
UIAlertAction *okAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"OK", @"OK action")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action)
{
NSLog(@"OK action");
}];
UIAlertAction *deleteAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"Delete", @"Delete action")
style:UIAlertActionStyleDestructive
handler:^(UIAlertAction *action) {
NSLog(@"Delete action");
}];
[alertController addAction:cancelAction];
[alertController addAction:okAction];
[alertController addAction:deleteAction];
UIPopoverPresentationController *popover = alertController.popoverPresentationController;
if (popover) {
popover.sourceView = self.view;
popover.sourceRect = self.view.bounds;
popover.permittedArrowDirections = UIPopoverArrowDirectionUnknown;
} …Run Code Online (Sandbox Code Playgroud) uiactionsheet ipad uipopovercontroller ios8 uialertcontroller
这可能是不可能的,但我希望有人会知道如何做到这一点.
我有一个应用程序,我只从iPhone移植到环球.在iPhone上,我使用的是Tabbed应用程序.我使用三个选项卡显示正常数据.我有一个第四个标签,只有在满足某些条件时才会显示.要添加选项卡,我会:
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
{
UITabBarController *tabController = (UITabBarController *) self.rootViewController;
NSMutableArray* newArray = [NSMutableArray arrayWithArray: tabController.viewControllers];
[newArray addObject: [theStoryboard instantiateViewControllerWithIdentifier: @"AdditionalView-Phone"]];
[tabController setViewControllers:newArray animated:YES];
}
Run Code Online (Sandbox Code Playgroud)
对于iPad,我在初始视图上有足够的空间来显示iPhone UI中主要三个选项卡的所有内容.所以我需要的是"附加"数据的另一个(小)视图.我想使用popOver视图来完成它,所以我使用Nav bar和popover按钮设置初始视图,就像在Utility App模板中一样.但是现在我被卡住了.我无法弄清楚如何在运行时创建弹出窗口按钮并使其正确执行popOver视图.我可以像这样添加按钮:
UIBarButtonItem *flipButton = [[UIBarButtonItem alloc] initWithTitle: @"Modem" style: UIBarButtonItemStylePlain target: self action: @selector(togglePopover:)];
self.navBar.topItem.rightBarButtonItem = flipButton;
Run Code Online (Sandbox Code Playgroud)
但我得到一个例外:'NSInternalInconsistencyException',原因:'UIStoryboardPopoverSegue必须从一个条形按钮项或视图中显示.' 我很确定这是因为我没有为popOver segue设置锚点.故事板中不存在该按钮,因此我无法将其设置在那里.我似乎无法在运行时找到一个API来设置它.
我也尝试在IB中创建按钮,但不在视图层次结构中创建按钮,然后将rightBarButtonItem属性设置为现有按钮.这也有效,但我仍然无法将该按钮设置为弹出视图的锚点.我可以将导航栏设置为锚点,但这会使其锚定到导航栏中的标题,这看起来很傻.
有任何想法吗?
我正在创建iOS提供的popover的自定义布局.我已经将UIPopoverBackgroundView子类化,并让它为我的popover正确绘制背景.我的问题是现在UIPopoverController在popover上创建了一个内部阴影,影响了popover的contentViewController.我想删除这个内部阴影,所以只显示我的contentViewController的内容.
这是popover当前的外观,使用UILabel来演示对contentViewController的影响.

有没有办法去除这个内部阴影?
ios ×6
ipad ×6
objective-c ×4
cocoa-touch ×3
iphone ×3
autorotate ×1
ios5 ×1
ios7 ×1
ios8 ×1
uipopover ×1