ios - How to change UIView's position in code? -


I created a custom viewcase class connected to a xib layout file, and I added some labels to xib. But when I want to change the label's position in the code, it does not work, so why can you tell me? Here are the relative codes:

  Public override zero layouts subviews () {base.LayoutSubviews (); Var border = content view. Bounce; UILAB label_primoz = Retrolview ("label_preiaad"); Label_period.ContentMode = UIViewContentMode.Redraw; Label_period.Text = string.Format ("{0} 天 之 旅", m_travel_data.period); \\ Works Label_preod.fr = New Rectangle (20, label_preview.frame.ew, label_pre_frame.fr; method, label_preview.frame.heat); }  

This is strange, because the text has actually changed, but not the frame.

There are some things you can try here.

Try calling first

  label_period.SetNeedsLayout ();  

Or possibly (but unlikely)

  label_period.SetNeedsDisplay ();  

If none of those things are there, then I will be checking to see that you do not have any unnecessary layout restrictions declared in your .xib.

Although this is your direct question, I recommend instead of using the retrieve viewBID (...) , just refer to the view by its name (if If you have declared UIViewController in .vib, then you should be able to access the view within the UIViewController with this.label_period )

Finally, though I have to Your situation is not specific, I have to switch to the storyboard. Nsa do, you will like these little problems.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -