Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated to use constraints for better layout on universal devices #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

waterskier2007
Copy link

fix for issue #5

@cwRichardKim
Copy link
Owner

do you mind explaining the code a little bit? Is there a reason why you removed the corner radius and shadow path?

@waterskier2007
Copy link
Author

Ah sorry. That was for a project I was doing. You could change the corner and shadow path back.

Basically, when the view was setup from initWithCoder, if you are using a universal storyboard, the frame size is something like 480 x 600, so all of the sizes are wrong. It looks fine on an iPhone but if you move to an iPad with the same universal storyboard, the items are too small to fill the screen.

@cwRichardKim
Copy link
Owner

ok cool, I'm not very familiar with storyboard (I build everything programmatically). I'm just going to add a few comments to the code so I can better understand this

@waterskier2007
Copy link
Author

No problem. You don't have to merge it if you don't want to. But just to check out what I am talking about, if you create a universal project for iOS 8.0 or greater, you can use a universal storyboard for iPads and iPhone. Try adding an RKCardView as the entire view on a view controller and then run it on both an iPhone and an iPad. You should see that with the code based layout it doesn't fit the iPad but it does with my updated code. It's still all code and doesn't require any additional work in a storyboard, just plop it into a storyboard.

@cwRichardKim
Copy link
Owner

Yea I’m more concerned about how it’s going to affect programmatic builds (which is the majority of use cases). I’ll spend some time this weekend playing with it. Thanks for putting in the time though!

Richard Kim (Choong-Won)

On Wednesday, February 18, 2015 at 9:49 AM, waterskier2007 wrote:

No problem. You don't have to merge it if you don't want to. But just to check out what I am talking about, if you create a universal project for iOS 8.0 or greater, you can use a universal storyboard for iPads and iPhone. Try adding an RKCardView as the entire view on a view controller and then run it on both an iPhone and an iPad. You should see that with the code based layout it doesn't fit the iPad but it does with my updated code. It's still all code and doesn't require any additional work in a storyboard, just plop it into a storyboard.


Reply to this email directly or view it on GitHub (#6 (comment)).

@waterskier2007
Copy link
Author

It doesn't change programmatic builds at all. Check it out. Cheers!

@waterskier2007
Copy link
Author

It was personal aesthetic. Sorry, I thought i changed all of the values back to their originals. I copied over some stuff from my own project.

Also, you have to setTranslatesAutoresizingMaskIntoConstraints:NO]; on every view that you want to add constraints too

Basically, all this code is doing is using constraints to layout the views instead of hardcoding the frames, so that the views will scale with the screen size

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants