本周的任务相对于上周的网易云来说是一个不小的挑战与升级,尤其是在协议传值的运用方面,在写代码的时候虽然遇到了很多的困难,但是同时也学习到了很多的东西,拒绝摆烂

[self.navigationController pushViewController:ViewNext animated:YES];是行不通的,所以我们可以试着用弹出界面[self presentViewController:viewRegister animated:YES completion:nil];
@protocol Register <NSObject>
- (void)Register1: (NSMutableArray*) arrayRegister: (NSMutableArray*)arrayPassWord;
@end
@property(nonatomic, strong) NSMutableArray* array1;
@property(nonatomic, strong) NSMutableArray* array2;

- (void)pressRegister {
int bool1 = 0;
for (int i = 0; i < _array1.count; i ++) {
if ([_array1[i] isEqualToString:_textFieldUserName.text]) {
bool1 = 1;
break;
}
}
if (bool1 == 1) {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"警告" message:@"请勿重复注册!" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *sure = [UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil];
[alertController addAction:sure];
[self presentViewController:alertController animated:YES completion:nil];
} else {
[_array1 addObject:_textFieldUserName.text];
[_array2 addObject:_textFieldPassWord.text];
[_delegate Register1:_array1 :_array2];
NSLog(@"%@D-, %@D+", _array1[0], _array2[0]);
[self dismissViewControllerAnimated:YES completion:nil];
}
_textFieldUserName.text = nil;
_textFieldPassWord.text = nil;
}
@interface ViewControllerLoading : UIViewController<Register, UITextFieldDelegate>
- (void)Register1:(NSMutableArray *)arrayRegister :(NSMutableArray *)arrayPassWord;
- @property (nonatomic, strong) NSMutableArray* userName;
@property(nonatomic, strong) NSMutableArray* passWord;
_userName = [[NSMutableArray alloc] init];
_passWord = [[NSMutableArray alloc]init];
- (void)Register1:(NSMutableArray *)arrayRegister :(NSMutableArray *)arrayPassWord {
// 把账号米密码在这个地方当成2个数组存起来
_userName = [NSMutableArray arrayWithArray:arrayRegister];
_passWord = [NSMutableArray arrayWithArray:arrayPassWord];
NSLog(@"%@DD", _userName[0]);
NSLog(@"%@DD", _passWord[0]);
}
-(void) pressRegister {
NSLog(@"11111");
ViewControllerRegister* viewRegister = [[ViewControllerRegister alloc] init];
//
//注册代理的开始
viewRegister.delegate = self;
viewRegister.array1 = _userName;
viewRegister.array2 = _passWord;
[self presentViewController:viewRegister animated:YES completion:nil];
}
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
if (scrollView.tag == 1) {
[_myTimer invalidate];
_myTimer = nil;
}
}
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
if (scrollView.tag == 1) {
_myTimer = [NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(timeOut:) userInfo:nil repeats:YES];
}
}



UISegmentedControl即可滑动滚动视图完成界面的实现,唯一注意不论滑动上面还是下面都要同时实现变化- (void)pressSc: (UISegmentedControl*) seg{
if (seg.selectedSegmentIndex == 0) {
[_scrollView setContentOffset:CGPointMake(0, -40) animated:YES];
} else if (seg.selectedSegmentIndex == 1) {
[_scrollView setContentOffset:CGPointMake(width, -40) animated:YES];
} else if (seg.selectedSegmentIndex == 2) {
[_scrollView setContentOffset:CGPointMake(2 * width, -40) animated:YES];
}
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
if (_scrollView.contentOffset.x == 0) {
_sControl.selectedSegmentIndex = 0;
} else if (_scrollView.contentOffset.x == width) {
_sControl.selectedSegmentIndex = 1;
} else if (_scrollView.contentOffset.x == width * 2) {
_sControl.selectedSegmentIndex = 2;
}
}




本周任务较多,学习的时候还是有点事情影响,但还是学到了很多东西,自我感觉一般,再接再厉-关于小司