如何在iPhone应用程序中创建popover? [英] How to create popover in iPhone app?

查看:138
本文介绍了如何在iPhone应用程序中创建popover?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找iPhone中的popover,我想让它像iOS 5 Reader功能一样:

I'm looking for popover in iPhone and i want to make it like iOS 5 Reader feature:

经过一番研究后我发现了WEPopover和FPPopover,但我在寻找是否有类似的东西这个API内置了iphone SDK。

After little research i found WEPopover and FPPopover but i'm looking if there anything like this API built-in iphone SDK.

推荐答案

你可以制作一个 UIView 使用一些自定义艺术作品,并在视图顶部显示动画作为弹出框,其中包含一些按钮:

You could make a UIView with some custom artwork and display it with an animation on top of your view as a "popover" with some buttons like so:

UIView *customView = [[UIView alloc] initWithFrame:CGRectMake(25, 25, 100, 50)]; //<- change to where you want it to show.

//Set the customView properties
customView.alpha = 0.0;
customView.layer.cornerRadius = 5;
customView.layer.borderWidth = 1.5f;
customView.layer.masksToBounds = YES;

//Add the customView to the current view
[self.view addSubview:customView];

//Display the customView with animation
[UIView animateWithDuration:0.4 animations:^{
    [customView setAlpha:1.0];
} completion:^(BOOL finished) {}];

不要忘记 #import< QuartzCore / QuartzCore.h> ,如果你想使用 customView.layer

Don't forget to #import <QuartzCore/QuartzCore.h>, if you want to use the customView.layer.

这篇关于如何在iPhone应用程序中创建popover?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆