objective c - Setting popover segue programmatically using identifier from storyboard -


i have unique situation concerning popovers. finished adding third navigation item (uibarbuttonitem), had create programmatically, since storyboard allow 2 navigation items. new button segues view controller using identifier set in storyboard. works is, need segue popover instead of push. since button created in code, can't set anchor popover in storyboard. there way set segue type popover in storyboard , set anchor programmatically using identifier? or popover have done in code? below have new button , current segue.

button initialized
self.categorybuttonitem = [[uibarbuttonitem alloc]initwithtitle:nslocalizedstring(@"cat", @"categories button")   style:uibarbuttonitemstyledone target:self action:@selector(categorybuttondidpress:)]; self.navigationitem.rightbarbuttonitems = [self.navigationitem.rightbarbuttonitems arraybyaddingobject:self.categorybuttonitem]; 
current segue set push in storyboard.
-(void) categorybuttondidpress:(uibarbuttonitem *)sender {     [self performseguewithidentifier:@"categorysegue" sender:nil]; } 

the code below shows how might include popover in app based on limits provided above. feature not compatible iphone. may compatible iphone 6 plus (given it's capabilities split views). in xcode6 view controller identifier has been removed , replaced storyboard id (and possibly in later versions). important when instantiating view controller identifier, , sure create property uipopovercontroller. remember, starting point new developers.

property
@property (nonatomic, strong) uipopovercontroller *buttonpopovercontroller; 
method
-(void) categorybuttondidpress:(uibarbuttonitem *)sender {     uistoryboard *storyboard = self.storyboard;     categoryviewcontroller *categoryvc = [storyboard instantiateviewcontrollerwithidentifier:@"categoryviewcontroller "];     self.buttonpopovercontroller = [[uipopovercontroller alloc] initwithcontentviewcontroller:categoryvc];     [self.buttonpopovercontroller presentpopoverfrombarbuttonitem:self.categorybuttonitem permittedarrowdirections:uipopoverarrowdirectionany animated:yes];  } 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -