005
Upcoming SlideShare
Loading in...5
×
 

005

on

  • 900 views

 

Statistics

Views

Total Views
900
Views on SlideShare
900
Embed Views
0

Actions

Likes
0
Downloads
5
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \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

005 005 Presentation Transcript

  • 資策會行動開發學院iPhone/iPad App 設計開發沈志宗 stronger@mit.com.tw
  • 2012/11/20 iOS 語法基礎 使用者介面綜觀• TabBar Controller• UIScrollView 應用, 動、 放大、縮小• 實作結合使用者介面及圖 處理的相片瀏覽程式
  • Tab Bar Controller
  • Tab Bar - UITabBarController
  • UITabBarController• 選擇被選中的 ViewController tabBarController selectedViewController• 選擇被選中的 tab 頁籤索引值 tabBarController selectedIndex
  • 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
  • Tab Bar + Navigation Controllers
  • 實作練習 tabbar1
  • UIScrollView 應用 動、 放大、縮小
  • 認識 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
  • 在一般的 UIView 加入 subviewsubview.frame = ...;[view addSubview:subview];
  • 在一般的 UIView 加入 subviewsubview.frame = ...;[view addSubview:subview];
  • 在 UIScrollView 加入 subviewscrollView.contentSize = CGSizeMake(3000, 2000);subview1.frame = CGRectMake(2700, 100, 120, 180);[view addSubview:subview];
  • 在 UIScrollView 加入 subviewscrollView.contentSize = CGSizeMake(3000, 2000);subview2.frame = CGRectMake(50, 100, 2500, 1600);[view addSubview:subview];
  • 在 UIScrollView 加入 subview
  • 在 UIScrollView 加入 subview
  • 在 UIScrollView 加入 subviewsubview2.frame = CGRectMake(0, 0, 2500, 1600);scrollView.contentSize = CGSizeMake(2500, 1600);
  • 在 UIScrollView 加入 subviewCGPoint upperLeftOfVisible = scrollView.contentOffset;
  • 在 UIScrollView 加入 subview scrollView.bounds
  • 在 UIScrollView 加入 subviewCGRect visibleRect = [scrollView convertRect:scrollView.bounds toView:subview];
  • 實作練習ScrollViewDemo
  • 實作練習 ScrollViews 練習 UIPageControl 分頁UITapGestureRecognizer 手勢
  • 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
  • 實作結合使用者介面圖 處理的相片瀏覽程式
  • UIImagePickerController• sourceType UIImagePickerControllerSourceTypePhotoLibrary,     //圖庫中的所有資料夾 UIImagePickerControllerSourceTypeCamera,           //使用相機拍攝新的照片或影片 UIImagePickerControllerSourceTypeSavedPhotosAlbum  //圖庫中的預設資料夾(相機膠 卷) 範例 album, 11.1.4 可檢視相簿圖形(p.11-8)
  • http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/mobilehig/IconsImages/IconsImages.html
  • 沈志宗 Stronger Shen (Appletrees)• http://mit.com.tw http://iphone.to• stronger@mit.com.tw shen@iphone.to strongershen@gmail.com