【问题标题】:how to change the label from the horizontal scroller如何从水平滚动条更改标签
【发布时间】:2013-04-26 18:19:23
【问题描述】:

如何更改水平滚动条的标签? 我有一个包含玩家图像的页面,我想更改每个图像的标签 请帮助我,我找不到答案! 我很抱歉我的英语......

@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

【问题讨论】:

  • 您要更改标签的框架或文本。?

标签: ios horizontal-scrolling


【解决方案1】:

我希望你已经解决了。 您必须将标签的文本更改为 KLHorizo​​ntalSelect 的类。 在您在 plistPath 字符串中发布的代码中,有您的答案。您可以看到标签的名称和图像的名称文件都在“SectionData.plist”文件中。 打开此文件并更改您想要的内容。

【讨论】:

    猜你喜欢
    • 2015-04-24
    • 1970-01-01
    • 1970-01-01
    • 2022-07-20
    • 1970-01-01
    • 2012-03-31
    • 2016-06-20
    • 1970-01-01
    • 2012-06-16
    相关资源
    最近更新 更多