Ios 启动时,将SSRollingButtonScrollView滚动至特定位置
我已经实施了这个计划。我使用数组中的月份名称来处理这个问题。每次打开应用程序时,它都会在中间显示numberIos 启动时,将SSRollingButtonScrollView滚动至特定位置,ios,Ios,我已经实施了这个计划。我使用数组中的月份名称来处理这个问题。每次打开应用程序时,它都会在中间显示numberMAR 没有办法 - (void)configureCenterButton:(UIButton *)centerButton 我如何通过标题文本16或其他按钮显式地通过按钮,以便在应用程序启动时可以进入中间? 来自注释的代码 NSArray *digits = [NSArray arrayWithObjects:@"JAN",@"FEB",@"MAR",@"APR",@"MAY", @
MAR
没有办法
- (void)configureCenterButton:(UIButton *)centerButton
我如何通过标题文本16或其他按钮显式地通过按钮,以便在应用程序启动时可以进入中间?
来自注释的代码NSArray *digits = [NSArray arrayWithObjects:@"JAN",@"FEB",@"MAR",@"APR",@"MAY", @"JUN", @"JUL",@"AUG",@"SEPT",@"OCT",@"NOV",@"DEC" ,nil];
self.HeaderScrollView.AddLabel=YES;
self.HeaderScrollView.fixedButtonWidth = 50.0f;
self.HeaderScrollView.fixedButtonHeight= 45.0f;
self.HeaderScrollView.spacingBetweenButtons = 0.0f;
self.HeaderScrollView.notCenterButtonTextColor = [UIColor darkGrayColor];
self.HeaderScrollView.notCenterButtonBackgroundColor = [UIColor whiteColor];
self.HeaderScrollView.centerButtonBackgroundColor = [UIColor whiteColor];
[self.HeaderScrollView createButtonArrayWithButtonTitles:digits andLayoutStyle:SShorizontalLayout ];
[self.HeaderScrollView scrollToButtonIndex:5 animated:YES];
self.HeaderScrollView.ssRollingButtonScrollViewDelegate = self;
self.InnerScrollView.contentSize=CGSizeMake(327, self.InnerScrollView.frame.size.height);
添加以下方法,您需要传递要带到中心的按钮的索引 将其添加到头文件SSRollingButtonScrollView.m中
- (void)scrollToButtonIndex:(NSUInteger)buttonIndex animated:(BOOL)animated{
if(buttonIndex < _rollingScrollViewButtons.count){
UIButton *aButton = [_rollingScrollViewButtons objectAtIndex:buttonIndex];
[self moveButtonToViewCenter:aButton animated:YES];
}
}
并称之为
[self.phoneticSelector01 scrollToButtonIndex:3 animated:YES];
如果有帮助,请告诉我。更改第4位的数组索引,然后重试。和ssrollingbuttonscrollview在发布时未提供具体位置。问题是什么@user3518271,能否请您详细说明?我为问题添加了代码,如果可能,请删除注释。
[self.phoneticSelector01 scrollToButtonIndex:3 animated:YES];