Tag: uiviewcontroller

ViewControllers的NSMutableArray

我正在琢磨如何创build视图控制器的NSMutableArray。 然后,一旦我有了这个数组,我怎么能在检测左右UIgesture滑动的方法中使用它来animation进出视图… 这是拾取我的手势,只是在两个视图之间animation的方法,但是我想在视图控制器数组中的许多视图之间进行animation处理。 – (void)swipedScreen:(UISwipeGestureRecognizer*)gesture { //Left swipe if (gesture.direction == UISwipeGestureRecognizerDirectionLeft) { [UIView animateWithDuration:0.25 animations:^{ [self.detailViewB.view setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; [self.detailViewA.view setFrame:CGRectMake(-320, 0, self.view.frame.size.width, self.view.frame.size.height)]; }]; } //Right swipe else if (gesture.direction == UISwipeGestureRecognizerDirectionRight){ [UIView animateWithDuration:0.25 animations:^{ [self.detailViewA.view setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; [self.detailViewB.view setFrame:CGRectMake(320, 0, self.view.frame.size.width, self.view.frame.size.height)]; }]; } } 作为一个方面,我有一个主视图控制器,我加载这些视图控制器作为子视图…以及至less这是计划..我目前正在做这个与视图… http://dl.dropbox.com/u/53813770/SMPrototypeB.zip 更新: 这里是一个graphics显示你们,我正在努力实现。 […]

我怎么知道哪个ViewController是活动的?

我使用NSOperationQueue下载图像。 一旦图像下载完成,我想调用我的视图控制器的方法reloadView 。 但是,当下载正在进行时,用户已经移到不同的视图是相当可能的。 这个其他视图也将有一个reloadView方法(例如第一个视图显示总下载图像计数,第二个显示下载图像的缩略图) 基本上我想要的是,每当图像下载完成后,我应该能够调用主动视图控制器的reloadView方法,无论它是哪一个? 这怎么可能?

以编程方式加载视图

我的项目中有三个视图控制器。 我们称之为view1,view2和view3。 View2使用界面构build器中的segue从View1加载。 但view3需要从view2以编程方式加载,因为view2向REST服务器发出RESTful请求,并且该请求是asynchronous的。 我有一个单独的类来处理REST请求。 一旦我从REST服务器获得返回值,我调用view2的loadResultViewController方法。 但是我得到“libc ++ abi.dylib:终止与typesNSException的未捕获的exception”错误。 我该如何解决这个问题? 这是我的loadResultViewController方法 func loadResultViewController(summary: String) { let resultViewController = self.storyboard!.instantiateViewControllerWithIdentifier("ResultView") as! ResultViewController self.presentViewController(resultViewController, animated: true, completion: nil) resultViewController.summary.text = summary } 编辑: 这是完整的错误消息。 2015-09-14 14:01:13.645我的战略[5307:791826] *声明失败 – [UIKeyboardTaskQueue waitUntilAllTask​​sAreFinished],/SourceCache/UIKit_Sim/UIKit-3347.44.2/Keyboard/UIKeyboardTaskQueue.m:374 2015-09-14 14:01:13.678我的策略[5307:791826] *由于未捕获的exception'NSInternalInconsistencyException',原因:' – [UIKeyboardTaskQueue waitUntilAllTask​​sAreFinished]只能从主线程中调用。 ***第一次抛出调用堆栈:(0 CoreFoundation 0x000000010345dc65 exceptionPreprocess + 165 1 libobjc.A.dylib 0x0000000104fc8bb7 objc_exception_throw + […]

内存不被释放,甚至解散视图控制器之后调用dealloc方法

我在做什么是我在后台创build大量的UIView,并保存在一个NSMutableArray以后使用。 但是,当我closures视图控制器我检查内存在Xcode中,似乎有些内存不被释放。 我检查了; 视图控制器正在被释放。 请检查: 几次显示和解散视图控制器后,这发生。 其中一些正在被释放,但不是全部。 谢谢。

我如何准备一个UISplitViewController辅助VC来改变displayMode?

在iOS8中,UISplitViewController发生了变化,现在通过splitViewController:willChangeToDisplayMode:通知它的待处理displayMode更改的splitViewController:willChangeToDisplayMode: 我需要更新我的辅助视图控制器的一些方面来响应这个变化。 在这个委托方法中调用辅助VC的方法是很简单的,但是VC还不知道它的新边界是什么。 除了次要VC的边界KVO之外,是否有合理的方式通知VC的边界将会改变? 理想情况下,VC将有viewWillTransitionToSize:withTransitionCoordinator:调用displayMode更改,因为它提供了沿着过渡animation的能力。

如何使模式视图控制器透明

我使用目前的视图控制器来显示一个新的视图控制器从左..我使用的代码是.. UIViewController *controller; UINavigationController *navi; UIView *popmenu = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 300)]; popmenu.backgroundColor = [UIColor yellowColor]; controller.view = popmenu; controller.view.superview.backgroundColor = [UIColor clearColor]; navi = [[UINavigationController alloc]initWithRootViewController:controller]; navi.view.superview.backgroundColor = [UIColor clearColor]; CATransition *transition = [CATransition animation]; transition.duration = 0.4; transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; transition.type = kCATransitionPush; transition.subtype = kCATransitionFromLeft; [self.view.window.layer addAnimation:transition forKey:nil]; [self […]

从AppDelegate显示两个ViewController

当APP启动时 – 启动SigninView – 它是Okey。 接下来,如果成功 – 我需要showTripController()。 function工作,但没有显示? 什么问题? func showSigninView() { let controller = self.window?.rootViewController!.storyboard?.instantiateViewControllerWithIdentifier("DRVAuthorizationViewController") self.window?.rootViewController!.presentViewController(controller!, animated: true, completion: nil) } func showTripController() { let cv = self.window?.rootViewController!.storyboard?.instantiateViewControllerWithIdentifier("DRVTripTableViewController") let nc = UINavigationController() self.window?.rootViewController!.presentViewController(nc, animated:true, completion: nil) nc.pushViewController(cv!, animated: true); }

分享ADD和EDIT屏幕以使用相同的UIViewController是不是很好?

分享ADD和EDIT屏幕以使用相同的UIViewController是不是很好? 这是唯一的真正的区别是在一个值的情况下将填充现有(编辑)。 PS。 一些澄清。 所以,也许简单的情况下,只有一个或两个NSString字段(例如标题和说明) – 那么是否有任何错误(如任何gottchas)相关的使用相同的控制器/ NIB(视图)的EDIT和ADD?

无法在UIViewController中为UIBarButtonItem创buildIBOutlet

我试图从一个UIBarButtonItem创build一个IBoutlet到一个UIViewController,但是当按Ctrl +点击并拖动到控制器时,我什么也看不到指示器,因此不可能创build它。 不知道我在做什么错。 这是截图,以防万一它能清除一些东西: 提前感谢! 编辑:我也尝试手动创build@property (weak,nonatomic) IBOutlet UIBarButtonItem *barButtonItem; 然后按Ctrl +单击并拖动,但结果相同。

在自定义的segue中使用destinationViewControllerbutton

我的目标是定制一个自定义的animation,如下所示:我想让segue用sourceViewController中的一个button来覆盖一个来自destinationViewController的button,其效果类似于导航控制器的推动效果,即新button应该是将旧的button从右向左推。 我已经能够使旧button(从sourceViewController)按需要移开: [UIView animateWithDuration:1.0 animations:^{ // set the target frame for animated view sourceViewController.optionsButton.frame = leftButtonTargetFrame; } completion:^(BOOL finished) { [navigationController pushViewController:destinationViewController animated:NO]; // reset the button's frame back to its original frame sourceViewController.optionsButton.frame = leftButtonInitFrame; }]; 但我努力使新的button(从destinationViewController)进来。原因是, 我无法访问destinationViewController的视图元素 :执行segue时,他们没有实例化。 而且我不能animation一个没有实例化的button。 那么如何用sourceViewController中的buttonreplacesourceViewController中的button?