草庐IT

uiviewcontrollers

全部标签

ios - 如何在 UIViewController 中设置 tableView 单元格标识符?

谁来设置UIViewController中的tableView单元格标识符?使用UITableViewController我总是通过界面来完成(见下面的截图)现在,如果我使用UIViewController,我看不到该选项这是我的代码-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath{staticNSString*CellIdentifier=@"Cell";UITableViewCell*cell=[tableViewdequeueReusa

ios - iOS项目初始化项目中需要的所有UIViewController和UIView是不是一个好习惯?

我看过一个基于角色的iOS项目,作者在应用程序启动时就启动了几乎所有的View和Controller。并且主要使用NSNotification来进行它们之间的通信。甚至NSNotification也是同一种类型,这意味着所有通知都具有相同的名称:[[NSNotificationCenterdefaultCenter]addObserver:aObserverselector:aSelectorname:*notification_name*object:nil];[[NSNotificationCenterdefaultCenter]postNotificationName:*noti

ios - 恢复并保留从 UINavigationController 推送的 UIViewController,没有 Storyboard

我尝试恢复我从初始ViewController推送的简单UIViewController。第一个被保留,但第二个在重新启动时就消失了。我不使用Storyboard。我在每个ViewController中实现该协议(protocol),并将restorationIdentifier和restorationClass添加到它们中的每一个。第二个viewController继承自第三个viewController并从xib文件初始化。我不确定是否需要将UIViewControllerRestoration实现到第三个,因为我不直接使用它。我的代码看起来通常是这样的:-(id)initWith

ios - UIViewController 动画转换在 iOS8 中失败

我有一个自定义的UIViewController转换——在iOS7中,它工作得非常好。但是,在iOS8上运行时,我遇到了问题。具体来说,当呈现的ViewController被关闭时,原始ViewController的View完全消失——给我留下一个完全空白的屏幕。这是我的代码:@implementationDDCardTransition-(NSTimeInterval)transitionDuration:(id)transitionContext{return0.5f;}-(void)animateTransition:(id)transitionContext{UIViewCon

ios - 当不再显示 UIViewController 时如何继续 CAKeyframeAnimation?

我正在使用以下代码开始基本动画(遵循路径的UIImageView):CAKeyframeAnimation*bounceAnimation=[CAKeyframeAnimationanimationWithKeyPath:@"position"];bounceAnimation.path=cgpath;bounceAnimation.duration=40.0;bounceAnimation.rotationMode=kCAAnimationRotateAuto;[img.layeraddAnimation:bounceAnimationforKey:@"animateLayer"];

ios - 应用程序在 UIViewController : com. apple.main-thread 中的用户设备上崩溃

我使用fabric.io来跟踪用户设备上的崩溃。我收到许多带有以下堆栈跟踪的崩溃报告:0libobjc.A.dylib0x33e9ef46objc_msgSend+51UIKit0x29698225+[UIViewController_viewControllerForFullScreenPresentationFromView:]+1962UIKit0x29697cfb-[UIWindow_scrollToTopViewsUnderScreenPointIfNecessary:resultHandler:]+4423UIKit0x29697b1f-[_UIScrollsToTopIn

ios - Storyboard UIViewControllers 对于 iPhone 屏幕尺寸来说太大了

每当我创建一个新项目并选择单View应用程序时,UIViewControllers对于任何iPhone模拟器来说都太大了。如何调整ViewController的大小以适合屏幕?以及如何开始使界面在具有不同分辨率的多个设备上保持一致? 最佳答案 转到属性检查器->选择一个ViewController->在模拟指标中,更改大小。您可以选择您需要的尺寸。 关于ios-StoryboardUIViewControllers对于iPhone屏幕尺寸来说太大了,我们在StackOverflow上找到

ios - 如何创建更干净的 UIViewController?

这个问题在这里已经有了答案:ChangetemplatesinXcode(10个答案)关闭7年前。总是,当我创建ViewController时,我有这个:#import"SomeVCC.h"@interfaceSomeVC()@end@implementationSomeVC-(void)viewDidLoad{[superviewDidLoad];//Doanyadditionalsetupafterloadingtheview.}-(void)didReceiveMemoryWarning{[superdidReceiveMemoryWarning];//Disposeofanyr

ios - 如何将另一个 UIViewController 添加到现有的 UINavigationController

我有一个带有两个ViewController的应用程序。第一个嵌入在导航Controller中并有一个导航栏,在第一个ViewController中的某个方法结束后,我以编程方式呈现第二个ViewController。这工作正常,但这样第二个ViewController不是导航Controller堆栈的一部分,并且与第一个ViewController没有任何关系。像这样,我无法利用导航Controller。关于如何解决这个问题的任何想法?在用户从照片库中选取图像后,我向第二个ViewController显示此代码:-(void)imagePickerController:(UIImag

ios - iOs Xcode 中的 UIViewController 中的 UIView 中的 UITableView

我想在xcode中实现以下功能。我有一个ViewController。在这个UIViewController中,我有一个UITabBar。它们下面是一个UIView。将UITableView添加到UIView的最佳方法是什么?然后能够单击UITableViewCell并打开另一个UIViewController以显示有关UITableViewCell的更多信息?这是我的Storyboard的当前设置:你能给我一个解决这个问题的方法吗?谢谢 最佳答案 您需要解决问题的方法,但我不确定您的问题是什么。在Storyboard中,将UIVi