iPhone應用開發之UIPopoverController

來源:互聯網
上載者:User

iPhone應用開發中的UIPopoverController是本文要介紹的內容,UIPopoverController按件,只有在ipad中才可以使用。內容不多,主要是以代碼來實現UIPopoverController的使用方法,一起來看詳細內容。

代碼如下:

 
  1. - (void)viewDidLoad   
  2. {  
  3.     [super viewDidLoad];  
  4. //列表  
  5. PopTableController *table=[[PopTableController alloc] init];  
  6. //設定展示的地區大小  
  7. table.contentSizeForViewInPopover=CGSizeMake(200, 300);  
  8. //執行個體化UIPopoverController  
  9. popoverController= [[UIPopoverController alloc] initWithContentViewController:table];   
  10. //使用點擊按鈕  
  11. list =[[[UIBarButtonItem alloc] initWithTitle:@"列表" style:UIBarButtonItemStyleBordered target:self action:@selector(list:)] autorelease];     
  12. //將按鈕添加到toolbar上  
  13. [toolbar setItems:[NSArray arrayWithObject:list]];  
  14. }  
  15. //按鈕的事件  
  16. -(void)list:(id)sender  
  17. {  
  18. // presentPopoverFromBarButtonItem:list   剪頭指向list這個按鈕  
  19. [popoverController presentPopoverFromBarButtonItem:list permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];  
  20. }  
  21. //隱藏  
  22. -(void)missView  
  23. {  
  24. //隱藏視圖  
  25. [popoverController dismissPopoverAnimated:YES];  

小結:iPhone應用開發之UIPopoverController的內容介紹完了,希望通過本文的學習對你有所協助!

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.