Tag: uiviewanimationtransition

翻转和缩放3D转换问题(iOS 7+)

我正在尝试构build卡片翻转和缩放的转换。 我已经在折纸 – 电影(less于1Mb) 正如你所看到的,同时应用了3个变换:1.将视图的中心移动到屏幕的中心2.缩放3. 3D旋转 我们可以分为两个阶段的animation: 阶段1:button缩放,移动并在侧面旋转(PI / 2弧度)。 在阶段1结束时button消失。 阶段2: toView (我的模态视图)旋转(从-PI / 2到0弧度),放大到正常大小,并将视图的中心移动到屏幕中心。 如果我们排除反弹 – 这是非常简单的转换。 但是在构build时遇到了一些问题: 我只是一个button,而不是整个视图。 这个button背后有一个背景。 所以,如果我应用CATransform3DMakeRotationbutton的一半消失 – 它与3D空间(Z轴)中的背景相交。 有没有办法在这里使用3DTransform? 2.屏幕上有一些文物。 我不知道他们来自哪里。 你可以检查结果电影 (3.8Mb)。 我放慢了电影中第二张卡片的animation。 这是我的这个animation的代码: func animateTransition(transitionContext: UIViewControllerContextTransitioning) { let container = transitionContext.containerView() let fromViewBig = transitionContext.viewForKey(UITransitionContextFromViewKey)! let toView = transitionContext.viewForKey(UITransitionContextToViewKey)! // Converting button to UIImageView and hiding […]

自定义ViewController转换不能正确resize

我有我的应用程序中的导航控制器的自定义Viewcontroller转换。 在执行转换时,它没有正确调整子视图控制器的内容。 默认的转换不会调整它的大小。 我在Github上添加了一个示例项目来演示这个问题。 embedded在导航控制器中的VC import UIKit class PopoverVCViewController: UIViewController, UIViewControllerTransitioningDelegate, UINavigationControllerDelegate { let animator = Animator() override func viewDidLoad() { super.viewDidLoad() navigationController?.delegate = self // Do any additional setup after loading the view. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } func navigationController(navigationController: UINavigationController, animationControllerForOperation operation: […]

Swift:自定义UIView.transition的问题?

好吧,我已经通过https://developer.apple.com/videos/play/wwdc2013/218/和SO问题类似的尝试使用标签栏控制器和它的viewcontrollers进行自定义转换,但在搞清楚主要步骤在这里。 我需要知道如何(意思是示例代码将是真正有用的)来调用一个自定义的UIView.transition或只是在UIView.transition的自定义option 。 我需要使用它来在标签栏控制器中的标签之间进行滑动/模式模仿转换。 我可以得到转换的唯一方法是使用下面的函数(这会使它们消失): func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool { if selectedViewController == nil || viewController == selectedViewController { return false } let fromView = selectedViewController!.view let toView = viewController.view UIView.transition(from: fromView!, to: toView!, duration: 0.3, options: [.transitionCrossDissolve], completion: nil) return true } 并在手动调用它,我编程chnage *selectedIndex*为我的选项卡控制器: //SWITCHES BUTTON ——————————————- func switchTab(index: […]

使用CGAffineTransformMakeScale的UIViewanimation以十进制数字立即改变大小

– (void)startAnimation { //reverse – shrinking from full size if (_reversed == YES) { //self.transform = CGAffineTransformMakeScale(1.0, 1.0); [UIView animateWithDuration:1.0f delay:0.0f options:UIViewAnimationOptionCurveLinear animations:^{ self.transform = CGAffineTransformMakeScale(0.1, 0.1); //this line does it instantly self.alpha = 0; } completion:^(BOOL finished) { [self removeFromSuperview]; }]; } else { //non reverse – expanding from middle self.transform = CGAffineTransformMakeScale(0.001, 0.001); […]

UiView.animateWithDuration不能animationSwift

我正在尝试使用下面的代码来animation显示/隐藏search栏(search栏应该从左边开始,并在1-2秒内向右扩展)。 但是,无论我投入了多less时间,它都不会立即显示animation和search条。 我注意到下面 持续时间不受尊重 甚至不延迟被尊重 animation没有发生。 组件立即显示 func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) { //code to get selected value… //Hide the collection view and show search bar UIView.animateWithDuration(10.0, delay: 0.0, options: UIViewAnimationOptions.TransitionCrossDissolve, animations: { self.searchBar.hidden = false self.searchBar.frame = CGRectMake(0, 0, 300, 44) //This doesn't work either }, completion: { (finished: Bool) in return true […]

如何在animateTransition期间获取ToViewController中子视图的框架:?

我使用iOS 7引入的新的自定义转换,我试图从我的'主'视图控制器的视图移动到我的'详细'视图控制器types的视图类似如何Photos.app放大照片时你点击它,除了这个视图在细节vc只占了一半的屏幕。 要做到这一点,我试图通过从细节或toViewController获取最终框架来animation这个视图到最后的框架。 然而,我得到的框架是从Interface Builder的toViewController视图的起始框架,而不是在AutoLayer传递给它之后出现的视图。 自动布局设置后如何获取框架? 在toViewController特殊视图框架返回到animateTransition之前,我尝试过[self.view layoutSubviews]:但是仍然给出了IB布局。 – (void)animateTransition:(id<UIViewControllerContextTransitioning>)transitionContext { UIViewController* toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; UIViewController* fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; [[transitionContext containerView] addSubview:toViewController.view]; toViewController.view.alpha = 0; [UIView animateWithDuration:[self transitionDuration:transitionContext] animations:^{ fromViewController.view.alpha = 0; toViewController.view.alpha = 1; fromViewController.specialView = [toViewController detailSpecialViewFrame]; } completion:^(BOOL finished) { [transitionContext completeTransition:![transitionContext transitionWasCancelled]]; }]; }

如何在转换之前强制加载UIWebView

iOS 6.1 当点击一个button时,我想执行从一个ImageView到一个WebView的过渡。 问题是,第一次加载webview,页面是白色的,转换后的HTML页面加载: NepContainerView *containerInFrame = (NepContainerView *)[self view]; UIWebView *webView = [[UIWebView alloc] initWithFrame:self.view.frame]; [webView loadHTMLString:html baseURL:nil]; [UIView transitionWithView:containerInFrame duration:DURATION_TRANS_PHOTO_DESC options:UIViewAnimationOptionTransitionFlipFromLeft animations:^{ [containerInFrame addSubview:webView]; [sender setTitle:@" Photo "]; } completion:NULL]; 我如何强制HTML页面在转换之前加载?

是否有可能animationUIEdgeInsets?

我一直试图在UIEdgeInsets改变animation。 我已经尝试使用UIView.animateWithDuration和insets只是跳转到最后的值。 有没有人知道这是一个不能animation的属性? 或者更好的是,是否有人知道一个animation内嵌的方法? 举个例子: // Starting inset values self.searchField.placeHolderInset = UIEdgeInsets(top: 0, left: 110, bottom: 0, right: 10) // Animation block UIView.animateWithDuration(0.1, animations: { self.searchField.placeHolderInset = UIEdgeInsets(top: 0, left: 18, bottom: 0, right: 10) }) 而不是在0.1秒内向左移动92像素,文本跳转到最终值。 searchField是一个UITextField而.placeHolderInset是用来确定UITextField占位符文本的插入符的UIEdgeInset。 编辑:另一种达到预期效果的方法是将UITextField的.textAlignment从.Center .textAlignment为.Center ,但不会animation。

TransitionFromView删除先前的视图

我在使用TransitionfromView时在我的应用程序中的视图之间转换时遇到问题。 build立 这是视图控制器的基本设置。 它有两个观点。 一个MKMapView和一个UITableView。 当按下切换button时,应该在地图和表格之间切换视图。 这是我的* .h文件 @interface BrowseBeaconsViewController : UIViewController <UITableViewDelegate, MKMapViewDelegate, UITableViewDataSource, CLLocationManagerDelegate > { __weak IBOutlet UIBarButtonItem *refreshBeacons; __weak IBOutlet UIBarButtonItem *toggleView; MKMapView* beaconMapView; __weak IBOutlet UITableView* beaconTableView; } 所以tableview来自故事板,而mapview是在程序中创build的。 问题 [UIView transitionFromView:beaconTableView toView:beaconMapView duration:1.0 options:UIViewAnimationOptionTransitionFlipFromLeft completion:^(BOOL finished) {}]; 当我从TableView从MapView转换时,tableview的值为空(0x0000000)。 我明白transitionfromview的行为是从父视图中删除视图。 但是,当我尝试添加tableview作为子视图后,它不起作用,因为值为null。 所以我的问题是如何在转换后添加tableview如果视图是无效的? PS:我很抱歉,如果这是一个简单的问题,但我是iOS编程的新手,并且在发布这个问题之前尝试在论坛中寻找。

用于UITabBarControlleranimation的转换委托

我已经创build了一个自定义的UIViewControllerAnimationTransition类,并且在切换选项卡时需要使UITabBarControlleranimation效果。 但tabBarController不使用常规标签栏。 我有一个自定义的实现,就像这样,当一个button被按下时,它会调用这个代码: tabBarController.selectedIndex = index 目前我有tabBarController (子类)作为它自己的transitionDelegate的委托。 虽然委托方法animationControllerForPresentedController从来没有被实际调用过。 标签栏控制器是自己的委托是好的吗? 如果是这样,为什么转换代码从来没有真正被调用?