Home Methods related to UILabel drawing/appearing on screen
Reply: 0

Methods related to UILabel drawing/appearing on screen

user8475
1#
user8475 Published in September 20, 2018, 5:08 pm

I'm new to iOS development so help me out here, I know iOS provides methods related to UIViews when then appear on screen, ViewWillAppear & ViewDidAppear, does iOS also provide such type of methods for UILabel too? I want to set my custom alignment to all the labels used in my app, when they appear on screen, so I want to do it using extension, would it be possible ?

share|improve this question
  • what you mean with custom alignment? – Reinier Melian Feb 14 at 7:04
  • @ReinierMelian in my project there are multiple labels in multiple view, each having different alignment, I want to apply same alignment to all the existing & future labels. – Zubair Feb 14 at 7:10
  • viewDidLoad/viewDidAppear/etc. are all methods onUIViewController, not UIView. If you have a custom subclass of UILabel (which inherits from UIView), you can override something like awakeFromNib (if you're using .xibs or storyboards) or layoutSubviews – Michael Hulet Feb 14 at 7:13
  • but you are talking about textAlignment? – Reinier Melian Feb 14 at 7:13
  • @ReinierMelian yes I want all the labels of app to have RightAlignment or LeftAlignment depending upon a condition. – Zubair Feb 14 at 7:14

2 Answers 2

active oldest votes
up vote 1 down vote accepted
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.336085 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO