Last active
January 18, 2017 15:03
-
-
Save boraseoksoon/c95baabe41b87e1aba8350a6ee07b6c2 to your computer and use it in GitHub Desktop.
iOS CocoaTouch How to put the UILabel Center for x or y independently
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| UIView *parentView, *childView; | |
| [childView setFrame:({ | |
| CGRect frame = childView.frame; | |
| frame.origin.x = (parentView.frame.size.width - frame.size.width) / 2.0; | |
| frame.origin.y = (parentView.frame.size.height - frame.size.height) / 2.0; | |
| CGRectIntegral(frame); | |
| })]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment