简体   繁体   中英

Setting UILabel text from NSDictionary

I have a question. I need setting text value into a UILabel from NSDictionary.

My code to set text into UILabel is:

Refunds *current = [refunds_view objectAtIndex:indexPath.row];
cell.sol_number.text = [NSString stringWithFormat:@"%@",current.company];

where Current is Refunds.h

 #import <Foundation/Foundation.h>


 @interface Refunds : NSObject

-(id)initWithJSONData:(NSDictionary*)data;

 @property (assign) NSNumber *refunds_id;
 @property (assign) NSNumber *request_number;
 @property (strong) NSString *policy_code;
 @property (strong) NSString *company;

@end

Refunds.m

 #import "Refunds.h"

 @implementation Refunds 

 @synthesize refunds_id;
 @synthesize request_number;
 @synthesize policy_code;
 @synthesize company;
 -(id)initWithJSONData:(NSDictionary*)data{
  self = [super init];
  if(self){
    NSLog(@"initWithJSONData method called ");


   refunds_id =  [data valueForKey:@"id"];
   request_number = [data valueForKey:@"request_number"];
   policy_code = [data valueForKey:@"policy_code"];
   company = [data valueForKey:@"company"];
  }
  return self;
  }
@end

when I try to set value into UILAbel no occurs the error But the value doesn't show complete, only show (

NSLog(@"%@",[current company]);

//This is the value of [current company]
2014-06-26 10:32:13.917 Benefits[7178:70b] (
Benefits
)

cell.sol_number.text = [NSString stringWithFormat:@"%@", current.company];

Any idea for this.

Thanks.

Best Regards.

我认为您需要使用公司价值而不是“日期”价值。

cell.sol_number.text = [NSString stringWithFormat:@"%@",current.company];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM