【发布时间】:2013-05-02 04:58:26
【问题描述】:
我将 iCarousel 集成到我的应用程序中。它工作正常。但我的要求是在单个视图中显示两个按钮以及这两个按钮的特定操作。我将按钮显示为
- (UIView *) carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view{
UIView *sampleView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 250, 300)];
sampleView.backgroundColor=[UIColor whiteColor];
UIButton* btntrans=[UIButton buttonWithType:UIButtonTypeCustom];
[btntrans setFrame:CGRectMake(45, 40, 105, 50)];
[btntrans setBackgroundColor:[UIColor clearColor]];
btntrans.titleLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:15];
[btntrans setTitle:@"" forState:UIControlStateNormal];
[btntrans setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[sampleView addSubview:btntrans];
UIButton* btntrans1=[UIButton buttonWithType:UIButtonTypeCustom];
[btntrans1 setFrame:CGRectMake(45, 90, 105, 50)];
[btntrans1 setBackgroundColor:[UIColor clearColor]];
btntrans1.titleLabel.font = [UIFont fontWithName:@"Arial-BoldMT" size:15];
[btntrans1 setTitle:@"" forState:UIControlStateNormal];
[btntrans1 setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[sampleView addSubview:btntrans1];
return sampleView;
}
我们可以使用
-(void)carousel:(iCarousel *)carousel didSelectItemAtIndex:(NSInteger)index
{
NSLog(@"ITEM SELECTED");
}
全视图选择。但是如何设置这两个按钮的两个具体动作呢?
提前致谢。
【问题讨论】:
-
试试这个对我有用。 Try this