G17
中山大學數據科學與計算機學院本科生實驗報告
(2019年秋季學期)
| 年級 | 2019級 | 專業(方向) | 軟件工程計應方向 |
| 學號 | 17343123 | 姓名 | 吳宗原 |
| 電話 | 15013029107 | 1120902512@qq.com | |
| 開始日期 | 2019.12 | 完成日期 | 2020.01 |
一、實驗題目
期末項目——
二、實現內容
本人負責的應用的實現部分:
1.個人信息頁面的UI優化 2.導航欄控制的三個頁面的手勢滑動(左右滑動切換頁面)的功能 3.底部導航欄的實現(點擊底部導航欄切換不同頁面) 4.整合代碼,協助完成測試三、實驗結果
(1)實驗截圖
(2)實驗步驟以及關鍵代碼
個人信息界面的UI
個人信息界面有以下組件:一個旋轉的個人頭像、一個Segmented控件引導的ViewController子界面,子界面中有個人的詳細信息以及一個退出登錄的Cell。
1.旋轉頭像的實現函數(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];底部導航欄的相關函數,包括滑動動畫的實現以及自定義導航欄。
1.滑動動畫相關
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四、個人總結與個人貢獻評分
個人感覺自己在這次項目中的貢獻不算太多,完成過程還是比較快的,完成的部分主要是一些前端的內容,包括TabBar和個人信息的界面,后端的內容并沒有涉及。但是還是感覺鞏固了很多學習到的東西,包括如何從服務器返回的json包中提取出想要的信息,一些自定義動畫、自定義組件的實現等內容。完成之后也是整合了其他同學的代碼,協助寫完后端的同學測試了通信的有效性,錄制了視頻。
個人貢獻評分:85
五、實驗思考及感想
這次的項目認識到了一個軟件開發的過程中需要的知識還是很多的,包括UI設計、前后端開發、軟件測試等多個方面,一個人是沒辦法面面俱到的,同時體現了多人開發時協作交流的重要性。這次項目還是盡可能把這學期學到的很多Objective-c的知識用上去了,也去了解了前后端交互的一些調用以及整個流程,總的來說還是獲益匪淺。
總結
- 上一篇: 压力测试的参考结果
- 下一篇: LCD1602调试工具