傳說中的比較高級一點的UI(201547)

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
  • PDF
  • PPt
4.從網站上得到圖片,並顯示,感謝某書的代碼片段:

#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]];

    

}







發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章