IOS 弹框 如果直接弹出一个自定义的视图 可以选用第三方:
MJPopup
弹出:
if(!bandview)
{
bandview=[[[NSBundle mainBundle]loadNibNamed:@"bandView" owner:selfoptions:nil] firstObject];
bandview.bdelagate=self;
[bandview setFrame:CGRectMake(0, 0, 320, 160)];
}
int offset=ISIPhone5?100:50;
[self presentPopupView:bandview animationType:MJPopupViewAnimationFadeoffset:offset];
收起
[self dismissPopupViewControllerWithanimationType:MJPopupViewAnimationFade];
一般的菜单弹出可用
KxMenu
NSArray *menuItems =
@[
[KxMenuItem menuItem:@"明细统计方式"
image:nil
target:nil
action:NULL],
[KxMenuItem menuItem:@"现金"
image:[UIImageimageNamed:@"action_icon"]
target:self
action:@selector(pushMenuItem:)],
[KxMenuItem menuItem:@"余额"
image:[UIImageimageNamed:@"check_icon"]
target:self
action:@selector(pushMenuItem:)],
[KxMenuItem menuItem:@"POS"
image:[UIImageimageNamed:@"reload"]
target:self
action:@selector(pushMenuItem:)]
];
KxMenuItem *first = menuItems[0];
first.foreColor = [UIColorcolorWithRed:47/255.0f green:112/255.0f blue:225/255.0f alpha:1.0];
first.alignment = NSTextAlignmentCenter;
CGRect rect=button.frame;
CGFloat height=0.0;
if(IOS7>=7.0)
{
height=64;
}
else
{
height=0.0;
}
[KxMenu showMenuInView:self.view
fromRect:CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, height)
menuItems:menuItems];
点击事件实现:
- (void) pushMenuItem:(KxMenuItem*)sender