开发者

UISplitview + tabbar + customaziation of popover button

I am working with an project with a tabbar and a uisplitview and It is working. I have added the uisplitview through code and t开发者_开发百科he project is a tabbar application. However I need a custom button, a segment controller on the navigation bar instead of just a barmenuitem so when in landscape it can swith between two views.

Any suggestions

Regards


I solved it myself, I dont believe it is the most elegant solution but it works.

When rotating to lanscape I change the apperance of the standard bar menu item with a segmentcontroller. When the segment controller is pushed it pops the popover view. The code is shown in the following:

- (void)splitViewController:(UISplitViewController *)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController: (UIPopoverController *)pc
{
popOverItem=barButtonItem;

[barButtonItem setCustomView:segmentedControl];

NSMutableArray *items = [[self.toolbar items] mutableCopy];
[items insertObject:barButtonItem atIndex:0];

[self.toolbar setItems:items animated:YES];
[items release];
self.popoverController = pc;
}

 -(void)segmentAction
 {
     [self.popoverController presentPopoverFromBarButtonItem:popOverItem permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

 }

Regards

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜