G17
中山大學(xué)數(shù)據(jù)科學(xué)與計(jì)算機(jī)學(xué)院本科生實(shí)驗(yàn)報(bào)告
(2019年秋季學(xué)期)
| 年級(jí) | 2019級(jí) | 專業(yè)(方向) | 軟件工程計(jì)應(yīng)方向 |
| 學(xué)號(hào) | 17343123 | 姓名 | 吳宗原 |
| 電話 | 15013029107 | 1120902512@qq.com | |
| 開始日期 | 2019.12 | 完成日期 | 2020.01 |
一、實(shí)驗(yàn)題目
期末項(xiàng)目——
二、實(shí)現(xiàn)內(nèi)容
本人負(fù)責(zé)的應(yīng)用的實(shí)現(xiàn)部分:
1.個(gè)人信息頁(yè)面的UI優(yōu)化 2.導(dǎo)航欄控制的三個(gè)頁(yè)面的手勢(shì)滑動(dòng)(左右滑動(dòng)切換頁(yè)面)的功能 3.底部導(dǎo)航欄的實(shí)現(xiàn)(點(diǎn)擊底部導(dǎo)航欄切換不同頁(yè)面) 4.整合代碼,協(xié)助完成測(cè)試三、實(shí)驗(yàn)結(jié)果
(1)實(shí)驗(yàn)截圖
(2)實(shí)驗(yàn)步驟以及關(guān)鍵代碼
個(gè)人信息界面的UI
個(gè)人信息界面有以下組件:一個(gè)旋轉(zhuǎn)的個(gè)人頭像、一個(gè)Segmented控件引導(dǎo)的ViewController子界面,子界面中有個(gè)人的詳細(xì)信息以及一個(gè)退出登錄的Cell。
1.旋轉(zhuǎn)頭像的實(shí)現(xiàn)函數(shù)(UIButton *)rotate360DegreeWithImageView:(UIButton *)imageView
2.子界面的信息 (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{NSString *cellID=@"ProfileViewCell";ProfileViewCell *cell= [tableView cellForRowAtIndexPath:indexPath];if(nil==cell){cell=[[ProfileViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];}cell.backgroundColor=[UIColor clearColor];cell.textLabel.backgroundColor=[UIColor clearColor];if(indexPath.row==4)cell.textLabel.text=@"退出登錄";else cell.textLabel.text=_details[indexPath.row+1];cell.textLabel.textAlignment=NSTextAlignmentCenter;//UIImageView *IconView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"背景1.jpeg"]];cell.imageView.image=[UIImage imageNamed:dataList[indexPath.row]];/*cell.detailTextLabel.text = details[indexPath.row];cell.detailTextLabel.textColor=[UIColor blackColor];cell.textLabel.textAlignment = NSTextAlignmentLeft;*/cell.layer.masksToBounds = NO;cell.layer.cornerRadius = 8.0;return cell; }3.毛玻璃效果
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];UIVisualEffectView *visualView = [[UIVisualEffectView alloc]initWithEffect:blurEffect];visualView.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height);;[self.view addSubview:visualView];底部導(dǎo)航欄的相關(guān)函數(shù),包括滑動(dòng)動(dòng)畫的實(shí)現(xiàn)以及自定義導(dǎo)航欄。
1.滑動(dòng)動(dòng)畫相關(guān)
2.自定義TabBarViewController
@interface TabBarViewController ()<UITabBarControllerDelegate>@property(nonatomic, strong)UIPanGestureRecognizer *panGestureRecognizer;@end@implementation TabBarViewController- (void)viewDidLoad {[super viewDidLoad];self.delegate = self;self.selectedIndex = 0;[self.view addGestureRecognizer:self.panGestureRecognizer];NSArray<UIColor *> *colors = @[[UIColor orangeColor], [UIColor redColor], [UIColor blueColor], [UIColor yellowColor], [UIColor purpleColor]];NSMutableArray *vcs = [[NSMutableArray alloc] init];for (UIColor *color in colors) {ViewController *vc = [[ViewController alloc]init];vc.view.backgroundColor = color;[vcs addObject:vc];}self.viewControllers = vcs;for (int i = 0; i < self.tabBar.items.count; i ++) {NSDictionary *dic = @{NSForegroundColorAttributeName: [UIColor colorWithRed:0.451 green:0.553 blue:0.584 alpha:1.00]};NSDictionary *selecteddic = @{NSForegroundColorAttributeName: [UIColor colorWithRed:0.384 green:0.808 blue:0.663 alpha:1.00]};UITabBarItem *item = [self.tabBar.items objectAtIndex:i];[item setTitleTextAttributes:dic forState:UIControlStateNormal];[item setTitleTextAttributes:selecteddic forState:UIControlStateSelected];switch (i) {case 0:item.title = @"壹";break;case 1:item.title = @"貳";break;case 2:item.title = @"叁";break;case 3:item.title = @"肆";break;case 4:item.title = @"伍";break;default:break;}} }- (UIPanGestureRecognizer *)panGestureRecognizer{if (_panGestureRecognizer == nil){_panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panGestureRecognizer:)];}return _panGestureRecognizer; }- (void)panGestureRecognizer:(UIPanGestureRecognizer *)pan{if (self.transitionCoordinator) {return;}if (pan.state == UIGestureRecognizerStateBegan || pan.state == UIGestureRecognizerStateChanged){[self beginInteractiveTransitionIfPossible:pan];} }- (void)beginInteractiveTransitionIfPossible:(UIPanGestureRecognizer *)sender{CGPoint translation = [sender translationInView:self.view];if (translation.x > 0.f && self.selectedIndex > 0) {self.selectedIndex --;}else if (translation.x < 0.f && self.selectedIndex + 1 < self.viewControllers.count) {self.selectedIndex ++;} }- (id<UIViewControllerAnimatedTransitioning>)tabBarController:(UITabBarController *)tabBarController animationControllerForTransitionFromViewController:(UIViewController *)fromVC toViewController:(UIViewController *)toVC{NSArray *viewControllers = tabBarController.viewControllers;if ([viewControllers indexOfObject:toVC] > [viewControllers indexOfObject:fromVC]) {return [[TransitionAnimation alloc] initWithTargetEdge:UIRectEdgeLeft];}else {return [[TransitionAnimation alloc] initWithTargetEdge:UIRectEdgeRight];}}- (id<UIViewControllerInteractiveTransitioning>)tabBarController:(UITabBarController *)tabBarController interactionControllerForAnimationController:(id<UIViewControllerAnimatedTransitioning>)animationController{if (self.panGestureRecognizer.state == UIGestureRecognizerStateBegan || self.panGestureRecognizer.state == UIGestureRecognizerStateChanged) {return [[TransitionController alloc] initWithGestureRecognizer:self.panGestureRecognizer];}else {return nil;} }- (void)didReceiveMemoryWarning {[super didReceiveMemoryWarning]; }@end四、個(gè)人總結(jié)與個(gè)人貢獻(xiàn)評(píng)分
個(gè)人感覺自己在這次項(xiàng)目中的貢獻(xiàn)不算太多,完成過程還是比較快的,完成的部分主要是一些前端的內(nèi)容,包括TabBar和個(gè)人信息的界面,后端的內(nèi)容并沒有涉及。但是還是感覺鞏固了很多學(xué)習(xí)到的東西,包括如何從服務(wù)器返回的json包中提取出想要的信息,一些自定義動(dòng)畫、自定義組件的實(shí)現(xiàn)等內(nèi)容。完成之后也是整合了其他同學(xué)的代碼,協(xié)助寫完后端的同學(xué)測(cè)試了通信的有效性,錄制了視頻。
個(gè)人貢獻(xiàn)評(píng)分:85
五、實(shí)驗(yàn)思考及感想
這次的項(xiàng)目認(rèn)識(shí)到了一個(gè)軟件開發(fā)的過程中需要的知識(shí)還是很多的,包括UI設(shè)計(jì)、前后端開發(fā)、軟件測(cè)試等多個(gè)方面,一個(gè)人是沒辦法面面俱到的,同時(shí)體現(xiàn)了多人開發(fā)時(shí)協(xié)作交流的重要性。這次項(xiàng)目還是盡可能把這學(xué)期學(xué)到的很多Objective-c的知識(shí)用上去了,也去了解了前后端交互的一些調(diào)用以及整個(gè)流程,總的來(lái)說(shuō)還是獲益匪淺。
總結(jié)
- 上一篇: 压力测试的参考结果
- 下一篇: LCD1602调试工具