005

  • 475 views
Uploaded on

 

More in: Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
475
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
5
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Transcript

  • 1. 資策會行動開發學院iPhone/iPad App 設計開發沈志宗 stronger@mit.com.tw
  • 2. 2012/11/20 iOS 語法基礎 使用者介面綜觀• TabBar Controller• UIScrollView 應用, 動、 放大、縮小• 實作結合使用者介面及圖 處理的相片瀏覽程式
  • 3. Tab Bar Controller
  • 4. Tab Bar - UITabBarController
  • 5. UITabBarController• 選擇被選中的 ViewController tabBarController selectedViewController• 選擇被選中的 tab 頁籤索引值 tabBarController selectedIndex
  • 6. UITabBarControllerDelegate決定某個頁籤是否可以被選上-(BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController頁籤被選中後會觸發的事件-(void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController通知代理者頁籤位置即將開始被調整-(void)tabBarController:(UITabBarController *)tabBarControllerwillBeginCustomizingViewControllers:(NSArray *)viewControllers通知代理者頁籤位置即將結束調整-(void)tabBarController:(UITabBarController *)tabBarControllerwillEndCustomizingViewControllers:(NSArray *)viewControllers changed:(BOOL)changed通知代理者頁籤位置已調整完畢-(void)tabBarController:(UITabBarController *)tabBarControllerdidEndCustomizingViewControllers:(NSArray *)viewControllers changed:(BOOL)changed
  • 7. Tab Bar + Navigation Controllers
  • 8. 實作練習 tabbar1
  • 9. UIScrollView 應用 動、 放大、縮小
  • 10. 認識 UIScrollView 的 property 與 method frame contentSize contentOffset contentInset minimumZoomScale maximumZoomScale -(UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView -(void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale: (float)scale -(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
  • 11. 在一般的 UIView 加入 subviewsubview.frame = ...;[view addSubview:subview];
  • 12. 在一般的 UIView 加入 subviewsubview.frame = ...;[view addSubview:subview];
  • 13. 在 UIScrollView 加入 subviewscrollView.contentSize = CGSizeMake(3000, 2000);subview1.frame = CGRectMake(2700, 100, 120, 180);[view addSubview:subview];
  • 14. 在 UIScrollView 加入 subviewscrollView.contentSize = CGSizeMake(3000, 2000);subview2.frame = CGRectMake(50, 100, 2500, 1600);[view addSubview:subview];
  • 15. 在 UIScrollView 加入 subview
  • 16. 在 UIScrollView 加入 subview
  • 17. 在 UIScrollView 加入 subviewsubview2.frame = CGRectMake(0, 0, 2500, 1600);scrollView.contentSize = CGSizeMake(2500, 1600);
  • 18. 在 UIScrollView 加入 subviewCGPoint upperLeftOfVisible = scrollView.contentOffset;
  • 19. 在 UIScrollView 加入 subview scrollView.bounds
  • 20. 在 UIScrollView 加入 subviewCGRect visibleRect = [scrollView convertRect:scrollView.bounds toView:subview];
  • 21. 實作練習ScrollViewDemo
  • 22. 實作練習 ScrollViews 練習 UIPageControl 分頁UITapGestureRecognizer 手勢
  • 23. UIImage• 直接載入在 App 內的圖片 UIImage *image = [UIImage imageNamed:@"DSC03027.jpg"];• 網路載入 NSURL *url = [NSURL URLWithString:@”http://xxx.jpg”]; NSData *data = [NSData dataWithContentsOfURL:url]; image = [[UIImageView alloc] initWithImage: [UIImage imageWithData: data]];• 模擬器路徑 /Users/username/Library/Application Support/iPhone Simulator• 存到相簿 UIImageWriteToSavedPhotosAlbum(image, self, @selector(image:didFinishSavingWithError:contextInfo:), nil); - (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo: (void *)contextInfo 範例 scroll_enhanced
  • 24. 實作結合使用者介面圖 處理的相片瀏覽程式
  • 25. UIImagePickerController• sourceType UIImagePickerControllerSourceTypePhotoLibrary,     //圖庫中的所有資料夾 UIImagePickerControllerSourceTypeCamera,           //使用相機拍攝新的照片或影片 UIImagePickerControllerSourceTypeSavedPhotosAlbum  //圖庫中的預設資料夾(相機膠 卷) 範例 album, 11.1.4 可檢視相簿圖形(p.11-8)
  • 26. http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/mobilehig/IconsImages/IconsImages.html
  • 27. 沈志宗 Stronger Shen (Appletrees)• http://mit.com.tw http://iphone.to• stronger@mit.com.tw shen@iphone.to strongershen@gmail.com