iOS5新开发的API总述——WWDC 2011

转自 [url]http://alloc.sinaapp.com/?p=208[/url]
iOS5发布了好长时间,一直没有时间好好看一下,从今天开始重新学一下WWDC2011,以便了解一下iOS5的新功能.

此篇只简单介绍一下iOS新的API.参考官方1-01 Session 100 – What’s New in Cocoa Touch.

1.UIStepper

iOS5新UI控件,用来数字输入.

2.UIAlertView新样式

typedef enum {
UIAlertViewStyleDefault = 0,
UIAlertViewStyleSecureTextInput,//密码输入框
UIAlertViewStylePlainTextInput,//一般输入框
UIAlertViewStyleLoginAndPasswordInput//两个输入框
} UIAlertViewStyle;

@property(nonatomic,assign) UIAlertViewStyle alertViewStyle;
- (UITextField *)textFieldAtIndex:(NSInteger)textFieldIndex
3.TV

4.UIScreen调节亮度

@property (nonatomic) CGFloat brightness;
@property (nonatomic) BOOL wantsSoftwareDimming;
5.UIScrollView delegate完成拖动时delegate

- (void)scrollViewWillEndDragging:(UIScrollView *)sv withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)tCO;
6.UIReferenceLibraryViewController显示词语解释

- (id)initWithTerm:(NSString *)term;
+ (BOOL)dictionaryHasDefinitionForTerm:(NSString *)term;
7.UISplitViewController delegate,显示隐藏时delegate

- (BOOL)splitViewController:(UISplitViewController *)svc shouldHideViewController:(UIViewController *)vc inOrientation:(UIInterfaceOrientation)orientation;
8.UITableView delegate,复制或剪切cell时delegate

- (BOOL)tableView:(UITableView *)tv shouldShowMenuForRowAtIndexPath:(NSIndexPath *)ip;
- (BOOL)tableView:(UITableView *)tv canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)ip;
- (void)tableView:(UITableView *)tv performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath;
9.UITableViewCell,从xib文件中获取cell

- (void)registerNib:(UINib *)nib forCellReuseIdentifier:(NSString *)identifier;
10.UIWindow keyboard notifications,键盘frame改变时notifications

NSString *const UIKeyboardWillChangeFrameNotification;
NSString *const UIKeyboardDidChangeFrameNotification;
11.UIImage,image动画

+ (UIImage *)animatedImageNamed:(NSString *)name duration:(NSTimeInterval)duration;
+ (UIImage *)animatedImageWithImages:(NSArray *)images duration:(NSTimeInterval)duration;
@property (nonatomic, readonly) NSArray *images;
@property (nonatomic, readonly) NSTimeInterval duration;
image平铺与拉伸

-(UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)i;
12.UIStoryboard,故事版

@property (readonly, retain) UIStoryboard *storyboard;
- (void)performSegueWithIdentifier:(NSString *)id sender:(id)sender;
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender;
13.UISlider,改变颜色

[aSlider setMinimumTrackTintColor:[UIColor redColor]];
14.UIAppearance应用于全部属性

@protocol UIAppearance <NSObject>
+ (id)appearance; ...
@end #define UI_APPEARANCE_SELECTOR
eg:

[[UISlider appearance] setMinimumTrackTintColor: [UIColor redColor]];//程序中所有slider改为红色
15.UIPageViewController

- (id)initWithTransitionStyle: (UIPageViewControllerTransitionStyle)style navigationOrientation:(UIPageViewControllerNavigationOrientation)orientation options:(NSDictionary *)options;
id <UIPageViewControllerDelegate> delegate;
id <UIPageViewControllerDataSource> dataSource;
UIPageViewControllerDelegate

- (void)pageViewController:(UIPageViewController *)pvc didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray *)prevViewCs transitionCompleted:(BOOL)completed;
- (UIPageViewControllerSpineLocation) pageViewController:(...)pvc spineLocationForInterfaceOrientation:(...)o;
UIPageViewControllerDataSource

- (UIViewController *) pageViewController:(UIPageViewController *)pvc viewControllerBeforeViewController:(UIViewController*)c;
- (UIViewController *) pageViewController:(UIPageViewController *)pvc viewControllerAfterViewController:(UIViewController *)c;
16.UIViewController

-(void)addChildViewController:(UIViewController *)cvc;
-(void)removeFromParentViewController;
@property (readonly) NSArray *childViewControllers;

-(void)transitionFromViewController:(UIViewController *)fVC toViewController:(UIViewController *)toViewController duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion;
17.UIDocument

- (id)initWithFileURL:(NSURL *)url;
@property (readonly) NSURL *fileURL;
@property (readonly, copy) NSString *localizedName;
@property (readonly, copy) NSString *fileType;
@property (copy) NSDate *fileModificationDate;
@property (retain) NSUndoManager *undoManager;

- (void)openWithCompletionHandler: (void (^)(BOOL success))completionHandler;
- (void)closeWithCompletionHandler: (void (^)(BOOL success))completionHandler;
- (BOOL)loadFromContents:(id)contents ofType:(NSString *)typeName error:(NSError **)outError;
- (id)contentsForType:(NSString *)typeName error:(NSError **)outError;
Errors

- (void)handleError:(NSError *)error userInteractionPermitted:(BOOL)interactionPermitted;
- (void)finishedHandlingError:(NSError *)error recovered:(BOOL)recovered;
- (void)userInteractionNoLongerPermittedForError: (NSError *)error;
Document States

enum { UIDocumentStateNormal,
UIDocumentStateClosed = 1 << 0,
UIDocumentStateInConflict = 1 << 1,
UIDocumentStateSavingError = 1 << 2,
UIDocumentStateEditingDisabled = 1 << 3
}; typedef NSInteger UIDocumentState;

@property (readonly) UIDocumentState documentState;
NSString *const UIDocumentStateChangedNotification;
18.管理资源库(没看懂)

• ALAssetsLibrary

- (void)addAssetsGroupAlbumWithName:(NSString *)name resultBlock:(ALAssetsLibraryGroupResultBlock)r;
• ALAssetsGroup

- (BOOL)addAsset:(ALAsset *)asset;
Modifying

-(void)writeModifiedImageDataToSavedPhotosAlbum:(NSData *)d metadata:(NSDictionary *)metadata completionBlock:(ALAssetsLibraryWriteImageCompletionBlock)block;
-(void)setImageData:(NSData *)data metadata:(NSDictionary *)metadata completionBlock:(ALAssetsLibraryWriteImageCompletionBlock)block;
19.其他

GameKit

Core Data

NewsstandKit

Twitter

CoreImage

GLKit
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值