Skip to content

Instantly share code, notes, and snippets.

@boraseoksoon
Last active January 18, 2017 15:03
Show Gist options
  • Select an option

  • Save boraseoksoon/c95baabe41b87e1aba8350a6ee07b6c2 to your computer and use it in GitHub Desktop.

Select an option

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
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