2013-04-26 56 views
0

如何從水平滾動條更改標籤? 我有一個頁面與球員圖像,我想改變每個圖像的標籤 請幫助我,我找不到答案! 對不起我的英語...如何從水平滾動條更改標籤

@interface KLViewController() 


@end 

@implementation KLViewController 

- (void)viewDidLoad 
{ 
[super viewDidLoad]; 
// Do any additional setup after loading the view. 
[self.navigationController.navigationBar setTintColor:[UIColor colorWithRed:10/255.0 green:37/255.0 blue:70/255.0 alpha:1]]; 

//Initialize the informtion to feed the control 
NSString* plistPath = [[NSBundle mainBundle] pathForResource: @"SectionData" 
                 ofType: @"plist"]; 
// Build the array from the plist 
NSArray* controlData = [[NSArray alloc] initWithContentsOfFile:plistPath]; 

// Do any additional setup after loading the view, typically from a nib. 
self.horizontalSelect = [[KLHorizontalSelect alloc] initWithFrame: self.view.bounds]; 
[self.horizontalSelect setTableData: controlData]; 
[self.horizontalSelect setDelegate:self]; 
//Customize the initially selected index - Note section is redundant but should always be 0 
[self.horizontalSelect setCurrentIndex:[NSIndexPath indexPathForRow:4 inSection:0]]; 

//Add the view as a subview 
[self.view addSubview: self.horizontalSelect]; 

} 


-(void) horizontalSelect:(id)horizontalSelect didSelectCell:(KLHorizontalSelectCell*) cell { 
    NSLog(@"Selected Cell: %@", cell.label.text); 


} 

- (void)dealloc { 
    [_players release]; 
    [super dealloc]; 
} 
- (void)viewDidUnload { 
    [self setPlayers:nil]; 
    [super viewDidUnload]; 
} 
@end 
+0

你想改變標籤的框架或文字。? – 2013-04-27 12:24:35

+0

改變文字... – user2321545 2013-04-27 20:19:30

回答

0

我希望你已經解決了。 您必須將標籤的文本更改爲KLHorizo​​ntalSelect的類。 在您發佈在plistPath字符串中的代碼中有您的答案。您可以看到標籤的名稱和圖像的名稱文件進入「SectionData.plist」文件。 打開這個文件並改變你想要的。