Tag: uiviewcontroller

当我重新加载我的UIWebView的内容时,做一个翻转animation(或类似的东西)

在我的项目之一,我只使用一个UIWebView。 我需要一个animation(例如翻转)当我重新加载我的webView与另一个内容…是否有可能创build一个翻转animation(或类似的东西)? 我必须创build一个假控制器来获取它? 解决scheme? 谢谢

触摸事件(touchesMoved)不工作在UIScrollView内的UIViews

我有一个UIScrollView内的UIView ,并且这些视图的UIViewControllers没有接收到触摸事件。 如果我将视图从滚动视图中移出,那么它就起作用了。 UserInteraction是所有视图的默认ON,但它仍然不起作用! 这一定是可能的,我会很感激,如果有人能指出我的方向正确! 非常感谢,

具有透明背景的ViewController通过推送转换input当前ViewController

我有这个故事板: 我的第一个ViewController以PNG图像为背景进行编程: – (void)viewDidLoad { [super viewDidLoad]; self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bgleft"]]; } 我的第二个ViewController具有透明背景,通过select故事板上的清除颜色作为背景属性。 但是当它在我的iPod上运行时,似乎我的第二个ViewController具有相同的背景,但是从右向左推送第一个ViewController背景。 我想要做的是: 当Segue检测到时,它会将第一个ViewController上的所有UI组件从当前位置移动到左侧,所以感觉就像它被第二个ViewController(但不是背景,我想把背景保持在它的位置)所推动的一样。 那么第二个ViewController上的所有UI组件都会使用我已经在Storyboard上设置的Push Transition作为透明的ViewController。 所以,它将从一个ViewController平滑过渡到另一个不移动背景。 我试着用这个代码: – (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@"goToViewTwo"]) { UIViewController *view2 = segue.destinationViewController; view2.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bgleft"]]; } } 但我不知道如何移动/animation所有UI组件(button,标签等)来执行我所描述的。 请告诉我该怎么做..谢谢。

UIViewController调整自己viewWillAppear和viewDidAppear之间?

我的项目中有一个非常奇怪的错误。 我有一个UIScrollView作为我的主要观点。 在里面,我有一个UIViewController (而不是UITableViewController ),它有一个UITableView实例variables,以及一些杂项UIButtons 。 我已经把视图控制器的视图框架设置为CGRectMake(0, 64, 320, 388) ,因为我有一个标签栏上面(这是不是function呢)。 起初,它工作得很好,看起来不错,但一旦我提出和解雇一个modalViewController (因此重新加载UIViewController ,我相信),它推动UIViewController的视图到屏幕的顶部(默认设置为CGRectMake(0, 0, 320, 460) wantsFullScreenLayout CGRectMake(0, 0, 320, 460) ,但是因为我把wantsFullScreenLayout设置为NO ,所以现在将它设置为CGRectMake(0, 0, 320, 388) 。 我已经将这个问题追踪到viewWillAppear和viewDidAppear之间的某处。 这是我的确切日志解散modalViewController : 2011-05-06 11:08:39.974 Campus [1570:207] Frame是0.000000,64.000000,320.000000,388.000000(viewWillAppear) 2011-05-06 11:08:40.378 Campus [1570:207] Frame是0.000000,0.000000,320.000000,388.000000(viewDidAppear) 正如你所看到的, viewWillAppear的框架是好的,但不是viewDidAppear 。 我已经做了以下事情来尝试修复它: – 在loadView , viewDidLoad , viewWillAppear和viewDidAppear设置所需的框架。 – 将我的wantsFullScreenLayout设置为NO 。 – […]

Swift SpriteKit:在GameScene中访问UIViewController的最佳实践

我想看看从GameScene访问UIViewController方法的最佳做法是什么。 现在我一直在使用NSNotificationCenter,但是我不想使用这个,因为我想要实现的特定function。 此外,如果没有任何其他方式通过GameScene获得对UIViewController的访问,那么我真正想知道的是一种能够在没有UIViewController的情况下在GameScene中呈现UIAlertController的方法。 我只是创build一个全局variables的UIViewController,但我听说这是不好的做法。 谢谢!

在Swift中为一个控制器属性赋值

我想在Swift中的视图之间传递一个intvariables,但我不知道如何访问其他视图控制器的属性。 在Objective CI中会做这样的事情 UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; AnsViewController *ansViewController = [storyBoard instantiateViewControllerWithIdentifier:@"ansView"]; ansViewController.num = theNum; [self presentViewController:ansViewController animated:YES completion:nil]; 而在另一个viewcontroller.h文件,我会写这个来声明属性来获取数据 @property (nonatomic) int num; 现在Swift我有这个 let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil) let ansViewController : UIViewController = storyBoard.instantiateViewControllerWithIdentifier("ansView") as UIViewController ansViewController.num = theNum; self.presentViewController(ansViewController, animated:true, completion:nil) 而在另一个.swift文件的其他视图控制器我做了num声明 let num: int 我很确定,这不是正确的方法,因为我得到了这一行的错误 ansViewController.num […]

iOS获得键盘窗口

所以在iOS 7中我总是有这样的键盘窗口: – (UIView *)keyboardView { UIWindow* tempWindow; //Because we cant get access to the UIKeyboard throught the SDK we will just use UIView. //UIKeyboard is a subclass of UIView anyways UIView* keyboard; NSLog(@"windows %d", [[[UIApplication sharedApplication]windows]count]); //Check each window in our application for(int c = 0; c < [[[UIApplication sharedApplication] windows] count]; c ++) […]

iOS将会转向ToInterfaceOrientation正确的使用

我有一个非常简单的UIViewController,我想弄清楚如何使用willRotateToInterfaceOrientation。 我的UIViewController有一个非常简单的viewDidLoad方法: -(void)viewDidLoad { [super viewDidLoad]; theBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 48.0f)]; theBar.tintColor = [UIColor orangeColor]; UINavigationItem *item = [[UINavigationItem alloc] initWithTitle:@"The Title"]; item.hidesBackButton = YES; [theBar pushNavigationItem:item animated:YES]; [item release]; [self.view addSubview:theBar]; } 所以基本上,我只是在我的控制器的顶部有一个UINavigationBar。 而已。 根据我在网上find的内容,我实现了一些轮换的方法: – (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return YES; } -(void)willRotateToInterfaceOrientation: (UIInterfaceOrientation)orientation duration:(NSTimeInterval)duration { if ((orientation == UIInterfaceOrientationLandscapeLeft) || (orientation […]

用于在iOS中实现完全自定义的containerViewController的类体系结构

我目前正在尝试构build自己的Custom ContainerViewController。 我非常熟悉iOS ViewController包含API(在iOS 5中引入)和新的iOS7 ViewController Transition API。 在实现我的容器时,我试图使用相同的模式UINavigationController和UITabBarController正在使用。 我的容器目前运行良好,正确使用animation和交互式转换。 问题是,我将大量的逻辑打包到我的UIViewController容器子类中。 它符合<UIViewControllerContextTransitioning>并使用iVars来存储该协议方法返回的所有值。 animation和交互逻辑已经在另一个类中分离了,第三方也可以使用类似于UINavigationControllerDelegate和UITabBarControllerDelegate的委托来提供自己的转换。 我现在要做的是将UIViewControllerContextTransitioning外包给一个单独的类,以创build苹果公司为它的containerVCs创build相同的模块性。 Apple为UIViewControllerAnimatedTransitioning和UIViewControllerInteractiveTransitioning方法提供了一个UIViewControllerOneToOneTransitionContext (私有API),用于传递给UIViewControllerAnimatedTransitioning对象的id<UIViewControllerContextTransitioning>对象。 所以他们不使用他们的UIViewController子类。 (这就是我现在所做的) 我当前的结构非常适合在转换逻辑在上下文中调用[updateInteractiveTransition:] , [completeTransition:]等方法,这些调用直接在我的containerController上进行,然后可以通过更新其他元素在它的视图。 (和UINavigationController一样,当你调用[updateInteractiveTransition:]并且它正在更新NavigationBar(交叉渐变)的内容)。 在另一个类中外包上下文转换逻辑意味着: 提供视图控制器和框架等等,这些视图保存在容器的堆栈中,从容器到上下文对象,因为上下文需要将它们提供给转换逻辑。 从容器上的上下文对象调用transition-callbacks,因为上下文对象是从转换逻辑接收它们的那个对象。 正如苹果使用这种阶级关系,我想一定有一些优势。 目前,我不知道是否应该继续我的实现,或者尝试使它像苹果提供的容器一样模块化。 也看到这个- 问题 ,我问同样的事情。 (更像是一个回答问题,对不起:/) 虽然我们在这个话题:是否有可能使我的容器与UIPercentDrivenInteractiveTransition工作? 该文件说,它在关键帧中剪切transitionAnimator执行的animation并自动“重放”animation过渡,所以我怀疑它可以与自定义容器一起使用。 谢谢你的帮助 !

在UiTableView顶部创build一个button

我想了解Facebook Messenger如何在留在UITableView之上的屏幕的button上创build一个button,并遵循滚动? 我想实现右下方的蓝色button。 我应该怎么做到这样的事情? 任何推动正确的方向将高度赞赏。