1.爲什麼不能改變控件的Frame呢?
昨天在做一個小Demo,需要改變某個按鈕的Frame
_btn.Frame=CGRectMake(...);
搞了半天都沒有實現,原來需要將"Use Auto Layout" ,在ViewController屬性設置欄第一個選項設置,去掉才能改變控件的大小。
2.分段控件:
獲取分段控件當前選中按鈕的標題
[mySegment titleForSegmentAtIndex:mySegment.selectedSegmentIndex];
3.Web視圖:
個人感覺比較不錯,直接與網絡交互,正如書上所說,UIWebView提供了高級功能打開了在應用程序中通往一系列全新可能性的大門。
可以方便的顯示HTML、加載網頁以及支持兩個手指張合與縮放的手勢。
Web試圖還可實現各種類型的文件。
- HTML、圖像和CSS
- Word文檔
- Excel
- KeyNote
- Numbers
- Pages
- PPt
#pragma mark 從網頁中獲取圖片
- (IBAction)GetFlower:(id)sender
{
NSURL *imageURL;
NSURL *detailURL;
NSString *imageURLString;
NSString *detailURLString;
NSString *color;
int sessionID;
color=[self.colorChoice titleForSegmentAtIndex:self.colorChoice.selectedSegmentIndex];
sessionID=random()%50000;
imageURLString=[NSString stringWithFormat:@"http://www.floraphotographs.com/showrandomios.php?color=%@&session=%d",color,sessionID];
detailURLString=[NSString stringWithFormat:@"http://www.floraphotographs.com/detailios.php?session=%d",sessionID];
imageURL=[NSURL URLWithString:imageURLString];
detailURL=[NSURL URLWithString:detailURLString];
[self.flowerView loadRequest:[NSURLRequest requestWithURL:imageURL]];
[self .flowerDetailView loadRequest:[NSURLRequest requestWithURL:detailURL]];
}