sef*_*osu 3 iphone objective-c ios
我正在做这样的事情:首先,在启动时,"接受"按钮被禁用,用户必须阅读文本视图区域中的条款和条件,然后启用接受按钮.这是我的代码到目前为止,有人能给我一些建议吗?
- (IBAction)acceptAction:(id)sender {
if ([self.termConditionTextView scrollsToTop] == true) {
[acceptButtonOutlet setEnabled:NO];
[[[UIAlertView alloc] initWithTitle:@"Term & Condition" message:@"Please read term & condition first. Thank you." delegate:nil cancelButtonTitle:@"Back" otherButtonTitles:nil] show];
} else {
[acceptButtonOutlet setEnabled:YES];
}
}
Run Code Online (Sandbox Code Playgroud)
创建按钮时,请设置 myButton.enabled = NO
设置UIScrollViewDelegate
滚动视图.
然后实现scrollViewDidScroll
委托功能.在该功能中,检查滚动视图的内容偏移量以查看是否已达到底部.像这样的东西:
- (void)scrollViewDidScroll: (UIScrollView*)scrollView
{
float scrollViewHeight = scrollView.frame.size.height;
float scrollContentSizeHeight = scrollView.contentSize.height;
float scrollOffset = scrollView.contentOffset.y;
if (scrollOffset + scrollViewHeight == scrollContentSizeHeight)
{
myButton.enabled = YES;
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
808 次 |
最近记录: |