UIPageControl用於提示此用者此頁面有多重顯示,
此元件的行為類似翻頁的動作,本範例為放置三張圖片,
滑動頁面與點擊UIPageControl替換圖片顯示,
並添加一個UIViewAnimationOptionTransitionFlipFromRight動畫效果。
Will 發表在 痞客邦 留言(0) 人氣(404)
UIPageControl用於提示此用者此頁面有多重顯示,
此元件的行為類似翻頁的動作,
本範例為放置三張圖片,點擊UIPageControl替換圖片顯示
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *myImage;
- (IBAction)pageChanged:(UIPageControl*)sender;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)pageChanged:(UIPageControl*)sender {
_myImage.image = [UIImage imageNamed:[NSString stringWithFormat:@"photo%ld.jpg",sender.currentPage+1]];
}
@end
Will 發表在 痞客邦 留言(0) 人氣(81)
此範例為點擊按鈕,顯示UIAlertView,
透過buttonIndex可得知點擊了哪個按鈕
viewController.m
#import "ViewController.h"
@interface ViewController ()
- (IBAction)toShow:(id)sender;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)toShow:(id)sender {
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"alertView" message:@"plz choice" delegate:self cancelButtonTitle:@"cancle:" otherButtonTitles:@"save",@"load", nil];
[alertView show];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
NSLog(@"%ld",(long)buttonIndex);
}
@end
Will 發表在 痞客邦 留言(0) 人氣(644)
UIProgressView可顯示正工作正在進行的進度,
此範例為點擊按鈕,並借助NSTimer去增加progress得值,
讓UIProgressView執行結束並跳出alertView提示user工作已完成。
viewController.m
Will 發表在 痞客邦 留言(0) 人氣(626)
UIActivityIndicatorView是用於當執行一個複雜作業時,
可使用IndicatorView提示使用者現在正在執行一個複雜作業,
並提示使用者等待此作業完成。
storyboard可設定indicator的樣式、顏色、初始狀態、停止時隱藏等等,
Will 發表在 痞客邦 留言(0) 人氣(771)