我有一個問題。我需要從NSDictionary設置文本值到UILabel。從NSDictionary設置UILabel文本
我的代碼來設置文本的UILabel是:
Refunds *current = [refunds_view objectAtIndex:indexPath.row];
cell.sol_number.text = [NSString stringWithFormat:@"%@",current.company];
WHERE CURRENT是 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
,當我嘗試設置值進入UILAbel沒有發生錯誤但值不顯示完整,只顯示(
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];
對此有任何想法。
謝謝。
最好的問候。
沒有日期屬性被發現在你的退款類.... – Rohit
對不起,我錯了。我需要設置de UILabel的價值。我需要設置的價值是[當前公司]; @Pfitz –
send me nslog current –