Haris
Haris

Reputation: 267

ios7 custom Navigation bar

I want customised navigation bar with custom views, which I have done successfully.

Labels are also used in it, now I want to change label text after some time, but it is showing very strange behaviour, It does not change value of label, not even remove it from superView. but sometimes it work just after few seconds the code execute. or work after several attempts (I am running timer to change values).

I don't know if it is strange behaviour from iOS SDK or may be there some more appropriate way to do this??

I also used tag but no success

  for(UILabel *view in subViews)
  {
       if (view.tag == 1)
       {
           view.text = @"someVal";
       }
       else if (view.tag == 2)
       {
           view.text = @"someVal2";
       }
       else if (view.tag == 3)
       {
           view.text = @"someVal3";
       }
   }

Upvotes: 0

Views: 70

Answers (1)

aBilal17
aBilal17

Reputation: 3142

If you are using background thread, then you have to come back on main thread to update UI,,

dispatch_async(dispatch_get_main_queue(), ^{
   //block to be run on the main thread
   [self.tableView reloadData];
 });

Upvotes: 1

Related Questions