iOS Swift Tutorial: Create a Circular Transition Animation (Custom UIViewController Transitions)

  Рет қаралды 110,734

Brian Advent

Brian Advent

Күн бұрын

Пікірлер: 90
@Asdfgh-g1d
@Asdfgh-g1d 3 жыл бұрын
I couldn't find anything that was easy to understand, so I was saved. I learned a lot. Thank you very much.
@bennychewDev
@bennychewDev 7 жыл бұрын
Thanks Brian, I learned a lot in this video. A while ago I already learned how to do a custom transition, but now I understand it better. Though I didn't quite understand what the fmax was for and also the offsetVector. I guess it is to make the circle bigger than the screen so it disappears, but I don't understand the math. Also I wonder if it is bad if you leave out the removeFromSuperView in the dismiss animation part. Weather it will have memory leaks or something. Or will you get multiple instances of the views when you don't remove it from the super view? Wonder how you can check this.
@jacksontech1
@jacksontech1 7 жыл бұрын
the mechanism on how the transition works needs more explanation, especially on conforming to the UIViewControllerAnimatedTransitioning & UIViewControllerTransitioningDelegate. Nevertheless, it's good that Brian created such video so that we can explore further ourselves. Thanks Brian!
@franzsud
@franzsud 7 жыл бұрын
Brian, I loved the tutorial, but I did not understand how to change the color of the secondViewController if I don't want it to have a yellow color
@florianleeser3643
@florianleeser3643 6 жыл бұрын
I had a simple ViewController which I embedded in a NavigationController. In this Controller there's the sourceButton and in another ViewController there's the targetButton. Now, how do I use the shwon code in my case? Because it's not working for NavigationController to ViewController. Any help?
@maheshgvelly
@maheshgvelly 7 жыл бұрын
cool animation and nice tutorial. Like the reusable circular class. Am trying to achieve the same with the default nav bar items, for instance a plus button in nav bar. But its not working. Can you please help ?
@zoeyaguilarshinoda
@zoeyaguilarshinoda 4 жыл бұрын
hi Brian! i have a question I try to make the animation but when I run it it doesn't look circular transition, it looks like a square transition
@DmitriiSeliutin
@DmitriiSeliutin 8 жыл бұрын
Hello, Brian, thank u for this awesome tutorial, i have a question, when i make a transition to the 2nd VC , first VC doesn't call lifecycle's methods view(Will\Did)Disappear, however 2nd VC completely overlays 1st VC, is it normal behavior for this situation ?
@OmarTorresR
@OmarTorresR 8 жыл бұрын
Brian, how could I do to work with cells? instead of button? some guide? Thanks man!!!
@edwarddanescu6181
@edwarddanescu6181 8 жыл бұрын
Hi Brian! I was wondering if I could use this animation in SpriteKit, so as a transition between two scenes.. So if there's a simple way of adapting this to SpriteKit. Please let me know because that would be so useful to me!
@theJeraldo7
@theJeraldo7 6 жыл бұрын
Subscribed! We’ll be doing a lot of animations in the new version of our app. And this is a good starting point for me. Thanks for the video. 👏🏼
@JensHagfeldt
@JensHagfeldt 8 жыл бұрын
Really nice tutorial. I will definitely be using transitions like this in my app... And will probably use two or more buttons for different features, just like Sash Q8tee asked about here. So a follow up on that would be great.
@csmaisuriya91
@csmaisuriya91 6 жыл бұрын
Hello Brain, can you please make a video on "How to change a height of UITableview cell based on the text of UiLabel, where my Tableview cell contains another controls also rather than UiLabel (eg. my cell contains one UILable and one button). FYI, I want it without using autolayouts (ie. by using auto resizing and height calculation mechanism for cell)
@fsdolphin
@fsdolphin 4 жыл бұрын
It would be cool if you could demonstrate how to do this transition in SwiftUI.
@dimiutube
@dimiutube 5 жыл бұрын
Wow! Thanks, Brian, for this great explanation about custom transition. This will be very helpful for making my project look better!!!
@turbocivic2012
@turbocivic2012 8 жыл бұрын
Do you know how to make custom shape animations like in the elevate app?
@RR-wp8yj
@RR-wp8yj 6 жыл бұрын
Great tutorial! The transition looks very very nice BUT i recently ran into a problem with this. If the child-view is open and the user gets a phone call (so the status bar is green) AND user than ends the call the child view gets messed up when the greeen In-call statusbar dissappears. I tried to fix this myself but failed. The Problem ist that the transitions-circle "around" the view gets affected by the In-Call green dropdown status bar. The whole transition gets pushed down a little, which is okay. BUT after the user ends the call it doesen't go into its original position. It stays there a few milimeters below the top of the screen. Check it yourself the simulator shortcut for triggering the green In-call status bar is >cmd+Y
@KarthikCSSJCE
@KarthikCSSJCE 8 жыл бұрын
This is so awesome. Thanks for the tutorial. But how to you make this work for a non-modal transition, like a Show inside a UINavigationController? Is that even possible?
@Blatherer325
@Blatherer325 7 жыл бұрын
+1 i am unable to get this working with a navigation controller, i tried using the .pop method in animatedcontroller forDismissed function but no effect, i still get a regular pop when calling "self.navigationController?.popViewController(animated: true)" Edit: Solution: You must use UINavigationControllerDelegate. Specifically the function func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationControllerOperation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? { if operation == .pop { transition.transitionMode = .present //THIS CAN BE CHANGED TO OBTAIN DESIRED EFFECT, for me this was what i wanted. transition.startingPoint = button.center transition.circleColor = color return transition }
@ayushbajaj4767
@ayushbajaj4767 7 жыл бұрын
This tutorial is very helpful, thank you it helped me a lot. How could you make the same transition with the same original View Controller but it is transitioning to a third View Controller?
@avinashgupta322
@avinashgupta322 7 жыл бұрын
HI Brian, its really nice animation.... its working fine when our viewcontroller class is initial view controller but its not showing the circular transition when i m making my navigation controller as initial view controller in a project its showing like push animation......... Please give me some suggesions for resolving this issue. Thanks
@avinashgupta322
@avinashgupta322 7 жыл бұрын
Got the solution.
@knowdaqueen177
@knowdaqueen177 7 жыл бұрын
Ashish Gupta can you help me?
@bisqqa1103
@bisqqa1103 6 жыл бұрын
I have the same problem how did you do it?
@maheshgvelly
@maheshgvelly 7 жыл бұрын
It is also not working if the view controller has NAGIGATION BAR embedded in it. How can do the same with navigation bar ?
@AcidRottenBrain
@AcidRottenBrain 7 жыл бұрын
How about using this with navigation controller?
@kevinodell2992
@kevinodell2992 7 жыл бұрын
Lets say i have two buttons i want the animation for that go to two different view controllers, everything is working except the error that i am receiving is signal sigabrt for the let secondVC = segue.destination. is there a way to correct this so that the second button in the third view controller works.
@brianharper3882
@brianharper3882 8 жыл бұрын
Thank you Brian. i have been looking for something like this for a while.
@97NJK
@97NJK 6 жыл бұрын
may i ask for the mainbutton why is it outlet instead of action when you connect to the view controller?
@RupeeInc
@RupeeInc 4 жыл бұрын
This is a great tutorial, I wish you had explained the logic of what you were doing before coding it all out
@TheJuliolocoh
@TheJuliolocoh 8 жыл бұрын
Can u how us to use coinbase api graph and how to make a vertical,horizontal
@MrjavoiThe
@MrjavoiThe 7 жыл бұрын
Nice finally found a tutorial with some advanced techniques in iOS. GJ!
@KarthiKeyan-cr4ju
@KarthiKeyan-cr4ju 3 жыл бұрын
Thanks but not working if embedded with navigation bar.
@lucasdebritoarruda7831
@lucasdebritoarruda7831 3 жыл бұрын
it works if you use navigationController?.present
@ariasfigueroa
@ariasfigueroa 8 жыл бұрын
Thanks Brian this tutorial helped me with some ideas for upcoming projects.
@michaelromanenko
@michaelromanenko 6 жыл бұрын
Thank you! Actually, this video is a very good introduction to implement any custom transition in general! Gave me understanding how this stuff really works!
@kuwaitkarate
@kuwaitkarate 8 жыл бұрын
Thank you , but how can i use it if i have more than 4 buttons in same view?? each button connect to different view ?
@Joeron79
@Joeron79 3 жыл бұрын
How to show/hide camera transition on UiTabbarController like Whatsapp?
@mikemorgano5505
@mikemorgano5505 6 жыл бұрын
will this still work with swift 4?
@denissondesouza
@denissondesouza 6 жыл бұрын
You said all there is to it at least 5 times, I thought you would never finish it. lol overall you did a fantastic job well done!!!
@BrianAdvent
@BrianAdvent 6 жыл бұрын
😀 thank you so much!
@zxish9017
@zxish9017 7 жыл бұрын
+BrianAdvent how do you add more than one view controllers
@keshavkumar1522
@keshavkumar1522 2 жыл бұрын
func getFrameForCircle(viewSize: CGSize, viewCenter: CGPoint, startPoint: CGPoint) -> CGRect { let xLength = fmax(startPoint.x, viewSize.width - startPoint.x) let yLength = fmax(startPoint.y, viewSize.height - startPoint.y) let offestVector = sqrt(xLength * xLength + yLength * yLength) * 2 let size = CGSize(width: offestVector, height: offestVector) return CGRect(origin: CGPoint.zero, size: size) } I don't understand this logic. Can you please elaborate this clearly?
@krutomjer
@krutomjer 8 жыл бұрын
Thank you for the video, I plan on using this as a settings VC and/or as an input VC.
@AlexdeKoning
@AlexdeKoning 6 жыл бұрын
There is something wrong with the calculations, somehow the viewcontroller that gets presented with this animation gets zoomed in somewhat which causes the UIViews to shift to the middle. This even causes the UIViews on the iPhone 5S to push to the right or pushed out of the screen, which makes this animation kind of useless.
@Blatherer325
@Blatherer325 7 жыл бұрын
+1 i am unable to get this working with a navigation controller, i tried using the .pop method in animatedcontroller forDismissed function but no effect, i still get a regular pop when calling "self.navigationController?.popViewController(animated: true)" Edit: Solution: You must use UINavigationControllerDelegate. Specifically the function func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationControllerOperation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? { if operation == .pop { transition.transitionMode = .present //THIS CAN BE CHANGED TO OBTAIN DESIRED EFFECT, for me this was what i wanted. transition.startingPoint = button.center transition.circleColor = color return transition }
@shingetzu88
@shingetzu88 5 жыл бұрын
Joe how were you able to do this? I added UINavigationControllerDelegate to the first VC and added this function. I tried using the if statement but doing "push" instead of "pop" since I am going to the 2nd VC but its not working.
@cruy
@cruy 8 жыл бұрын
totally awesome... more of these please :)
@gunthermeier9576
@gunthermeier9576 6 жыл бұрын
I am getting a Signal Sigabrt error as soon as i click the Open-Menu-Button Any ideas?
@pacoramirez8298
@pacoramirez8298 6 жыл бұрын
Nothing happens once I run the code
@sminkly
@sminkly 8 жыл бұрын
Hi. Really useful tutorial, thanks.
@lukasaudir8
@lukasaudir8 6 жыл бұрын
am I the only one who didn`t understand the line " let xLenght = fmax(startPoint.x, viewSize.width - startPoint.x)" ? why can't this constant just be "let xLenght = startPoint.x" ? thank you for the great material you provide on your channel
@brod515
@brod515 6 жыл бұрын
Did you figure out what the equation is doing, because I too have no idea what the fmax portion of the method does. Not to mention that the method has a viewCenter Parameter that is not even being used.
@brod515
@brod515 6 жыл бұрын
Hey, Don't know if you will find this but I figured it out. It's really simple once you see the picture, the problem is that he did not bother explaining it so it looks like it came out of nowhere. two things also cause confusion here; the first is the fact that he called the one of the variables offsetVector when it really shouldn't be called that as it is not offsetting anything really and the second (which I think is more of a mistake ) is he tags on viewCenter as a parameter to the method and it is never used. Ignoring this let me explain what that fmax() function was for (it's really obvious now that I think about it). Understand that the circle transition needs to fill the the whole screen and the way to do that is to look at the farthest corner on the screen to make sure the circle gets big enough to reach it. so you are trying to get the largest distance from one of the corners to the the point where the circle begins growing (startPoint). for the x value for example if the yellow button is closer to the left side of the screen so the distance to the right side of the screen as compared to the left side of the screen is larger and we want that distance thus using the width of the frame minus the startPosition.x to get that distance... same thing happens with the why coordinate. the we use those x and y to get the length. and create a CGRect using that size. all this ensures that the animation will just reach the farthest corner and then finish the animation. if your button is in the middle removing the x coordinate fmax() function and just sticking with startPosition.x won't make any difference since the button is in the middle and the distance on both sides of the screen is the same. but try removing the fmax() for the why and just using startPosition.y and you'll see what I mean. TL;DR: the fmax(startPosition.x, width - startPosition.x) function is trying to see whether the distance find which distance is greater between the button and the left side of the screen or the button and right side of the screen.
@MateiSuica
@MateiSuica 7 жыл бұрын
Great tutorial, thanks!
@adamstreak4059
@adamstreak4059 8 жыл бұрын
i'm big fan of you after this tutorial :) #swift3 !
@94Demka
@94Demka 8 жыл бұрын
Nice. I really like it
@75pics73
@75pics73 8 жыл бұрын
Once again Fantastic. More please MORE :)
@emreciftci5403
@emreciftci5403 7 жыл бұрын
You are AWESOME!!!!!!!!!
@kiranjasvanee288
@kiranjasvanee288 7 жыл бұрын
Great video man
@hilalalhakani9139
@hilalalhakani9139 7 жыл бұрын
i'm having troubles understanding the offset Vector can someone help me
@bhagyashingale5663
@bhagyashingale5663 6 жыл бұрын
Looks like a lot of more work compared to a simple scale transition
@dontknownothing8394
@dontknownothing8394 7 жыл бұрын
Hi , i'm doing it completely programmatically but i don't know how to set up the segue for storyboard... who can help me?
@Kaungsoe125
@Kaungsoe125 7 жыл бұрын
Since you are doing programatic way, you don't need to override prepareForSegue method, just write the code below let secondVC = YourSecondViewControlelr() secondVC.transitioningDelegate = self secondVC.modalPresentationStyle = .custom
@helmerbarcos
@helmerbarcos 7 жыл бұрын
below of what?? im having the same problem
@TejKiran
@TejKiran 6 жыл бұрын
It looks awesome!! :)
@labuten6646
@labuten6646 8 жыл бұрын
thanks a lot! very helpful!
@spongebobber1000
@spongebobber1000 8 жыл бұрын
Cool Tutorial!
@brightfuturebf
@brightfuturebf 8 жыл бұрын
This is soooo awesome!
@mohammadtahir7931
@mohammadtahir7931 7 жыл бұрын
how to show with navigation bar
@jeremyconley9061
@jeremyconley9061 7 жыл бұрын
You can embed a nav controller and change the segue to a modal one. And add a nav bar to the second VC if you want it.
@g00dvibes47
@g00dvibes47 7 жыл бұрын
dude, this is nasty. subbed.
@nomaaad8001
@nomaaad8001 7 жыл бұрын
amazing.. i can't following yet.
@TheJuliolocoh
@TheJuliolocoh 8 жыл бұрын
Like coinbase dashboard
@techaztech2335
@techaztech2335 7 жыл бұрын
Here is a custom class to make your buttons round instead of writing code in every view controller, just assign this as a subclass for the buttons and hit enter and you would see the custom radius option in the attributes inspector and set it to round the way you want and it would reflect right in the story board without having to built the app ---- import UIKit @IBDesignable class CircleButton: UIButton { @IBInspectable var cornerRadius: CGFloat = 30.0 { didSet{ setupView() } } override func prepareForInterfaceBuilder() { setupView() } func setupView(){ layer.cornerRadius = cornerRadius } }
@wondamaner
@wondamaner 7 жыл бұрын
This is silly. You should just assign view.height/2 and be done. Why are you hard coding it to 30?
@mawesome4ever
@mawesome4ever 8 жыл бұрын
That doesn't work anymore, there are a whole bunch of errors :/
@BrianAdvent
@BrianAdvent 8 жыл бұрын
Are you using Xcode 8? If you do, you shouldn't have any problems compiling this project. Try to compare your version with the one on GitHub (github.com/brianadvent/CircularTransition) to see if you made any mistakes.
@mawesome4ever
@mawesome4ever 8 жыл бұрын
I updated my Mac, the errors went away but i still get one error and one warning... Also, i don't have any iphone simulator on xcode anymore, not sure why. They were there before the update. The warning is "iOS Deployment Target '10.0' is newer than SDK 'iOS 9.3' in target CircularTransition" and the error is "No matching provisioning profiles found: No provisioning profiles with a valid signing identity (i.e. certificate and private key pair) matching the bundle identifier “com.brianAdvent.CircularTransition” were found." I don't know how to go about to fix this, please help!
@chaitanyaramji
@chaitanyaramji 8 жыл бұрын
Hi Brian, If I wanted to use this animation in a collectionView's didSelect Method will tranisitioning to another ViewController purely with code, how would I achieve that?
@guruitcompany
@guruitcompany 8 жыл бұрын
nice!
@s11gangsta
@s11gangsta 7 жыл бұрын
there are 4 types errors with mine, 1) Cannot assign value of type 'CGPoint' to type 'CGRect' & 2) "Cannot convert return expression of type 'CGRect' to return type 'CGPoint'" & 3) "Expected '}' at end of brace statement" 4) "Expected '}' in class" Please Help
@bloblyblo
@bloblyblo 8 жыл бұрын
Hi, we need more stuff about UI how about implementing this floating action github.com/Ramotion/circle-menu and when the menu is pressed or shown, the background becomes blur. thanks.
@someguytu
@someguytu 8 жыл бұрын
Swift is definitely not a rapid prototype language. You can get this done in java so much faster. I am new to swift, and in comparison to nodejs laravel css and html5, it is just absurdly complicated and time consuming, to even get the smallest task done. Even tables seems to be a complete pain, and that is sadly the first thing you learn. Just giving my point of view.
@adityagarg190
@adityagarg190 7 жыл бұрын
If I may ask, how would this be faster in java?
@someguytu
@someguytu 7 жыл бұрын
try ionic.io/ for apps and unreal engine 4 for games. I honestly cant see any reason to use swift if you are looking to rapid prototype anything. Also you can do this same transition with 4 lines of code in css and javascript rather than all this craziness.
@gilangrilhami
@gilangrilhami 7 жыл бұрын
hey Brian, awesome tutorial, i really love it :) But i had some issue when i was pressing the menu button. If you don't mind, please take a look at my question on stack overflow stackoverflow.com/questions/41415033/i-got-a-thread1-exc-bad-instruction-while-trying-to-run-xcode
@imax21i
@imax21i 8 жыл бұрын
nice but too Android style :|
@AndrewTimosca
@AndrewTimosca 7 жыл бұрын
Holy hell. Talk slower. This tutorial is definitely for advanced peeps.
@wondamaner
@wondamaner 7 жыл бұрын
The call it Computer Science for a reason. Coding is not the applicable term for writing software...
iOS Swift Tutorial: Material Design Onboarding with Cool Animations
31:01
ROSÉ & Bruno Mars - APT. (Official Music Video)
02:54
ROSÉ
Рет қаралды 287 МЛН
Анимация вращения UIView
10:27
SwiftBook
Рет қаралды 4,7 М.
iOS Swift Tutorial: Create an Animated Control - Stacked Menu
48:26
Custom View Controller Transitions
35:21
Code Pro
Рет қаралды 26 М.
iOS Swift Tutorial: Simple and Cool UIView Animations
20:27
Brian Advent
Рет қаралды 85 М.
Swift Animations: Custom Counting Label - CADisplayLink
21:43
Lets Build That App
Рет қаралды 34 М.
Лекция 22 - Анимация, UIView transition, UIVIew animation, DynamicAnimation
2:01:23
iOS Swift Tutorial: Insane Animations with AfterEffects and Lottie
23:27
Lecture 1 | Stanford CS193p 2023
1:11:04
Stanford CS193p
Рет қаралды 106 М.
The Vim Experience
45:19
Bog
Рет қаралды 139 М.