ios - iOS7: UILabel Text in Custom Cell does not appear without GCD -


Appears with a text block in a custom cell label Is this a better way to accomplish this?

Custom CL H

  @interface custom cell: UITTEWewsCell property (nonatomatic, strong) UILBL * label; @protecti (nanatomic, strong) UIView * circle; @end   

Custom CLM

  @implementation Custom CL - (zero) layout attributes {[Super layouts_viewings]; Self.circle = [[UIView alloc] initWithFrame: CGRectMake (10, 10, 40.0f, 40.0F)]; [Self.circle setBackgroundColor: [UIColor brownColor]; Self.label = [[UILabel alloc] initWithFrame: CGRectMake (15, 20, 200.0f, 50.0f)]; Self.label.textcolor = [UIColor blackcolor]; [Self.contentView addSubview: self.label]; [Self.contentView addSubview: self.circle]; // I also tried myself [self-viewview: self.label]; } TableView.m  
  - (UITableViewCell *) TableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath {static NSString * customCellIdentifier = @ "CustomCell"; Customcell * cell = (customsell *) [TablesviewUQUrubleWebIdentifier: customsendifier]; If (cell == blue) {cell = [[custom CL light] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: inviteCellIdentifier]; } Dispatch_async (dispatch_get_main_queue (), ^ {[[cell label] setText: @ "This label is"]; [cell setdes display];)); Return cell; }   

The only way to display UILBL text is by using the up block. If I do not use the block and just use the cell.Label.text = @ "this is a label" then [cell setNeedsDisplay]; , the text is not visible and I have to scroll the table quiver so that the cells can be reloaded, and only then the text appears in the label.

Is there any better way or do I get stuck with the block use?

You do not create label for UILabel The cell's layoutSubviews method is not called property which is long after you try to set the label's text in your table view controller.

The custom build of the label initWithStyle: reuseIdentifier: method. Also add the call to self.contentView addSubview: in the init ... method. The only thing that should be in the layoutSubviews method is the frame's frame setting.

Once you do this, you will not need to use the GCD. Cellophora ... method.

Your use of BTW - GDC solves this issue because it gives the label a label for its layout subsystems method, to create a label.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -