small size modal view in ipad

2024-04-19 21:58
文章标签 small view ipad modal size

本文主要是介绍small size modal view in ipad,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

需求:iPad里,要求popup一个login window,该window的size是小的,不要遮住整个iPad当前显示的view。

 

我尝试使用下列代码 (其中LoginViewController是loginview with full iPad screen size,其中中间部分设置成蓝色,而周边部分设置成透明色,造成在popup之后周边部分不遮住当前显示view。

    FormStyleViewController* form=[[FormStyleViewController alloc]initWithNibName:@“LoginViewController"bundle:nil];//support modal view clear backgroundself.modalPresentationStyle= UIModalPresentationCurrentContext;[self presentViewController:formanimated:YEScompletion:nil];

对于上面代码,如果删除

    self.modalPresentationStyle= UIModalPresentationCurrentContext;

那么周边背景就会变黑色

 

如果添加

    form.modalPresentationStyle = UIModalPresentationFormSheet;

那么就会以form style view来显示,虽然整个view size变小了,但导致周边背景色变成灰色而不是透明。

 

不过上述代码导致了一个问题,就是如果旋转iPad,popup window会旋转,但parent view则不会旋转。但如果以formstyle view来显示,则parent view也会旋转。这个issue解决不了,虽然这个链接提供了方法,但我在ios7里运行时画面会变黑。所以使用UIModalPresentationCurrentContext并不是解决方案,除非你的app不能旋转

http://stackoverflow.com/questions/17835123/how-to-rotate-parent-view-controller-when-child-view-controller-orientation-chan/17839785

 

因此,如果你要在ipad里的当前fullscreen view上弹出一个小窗口的话,你有如下选择: 

1. 使用popover 

2. 使用modalPresentationStyle。但要注意,modalPresentationStyle的bg color无法是透明的,所以你必须用尽整个view screen 

3. 不使用小窗口,而使用modal view with full screen


这篇关于small size modal view in ipad的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/918537

相关文章

python中os.stat().st_size、os.path.getsize()获取文件大小

《python中os.stat().st_size、os.path.getsize()获取文件大小》本文介绍了使用os.stat()和os.path.getsize()函数获取文件大小,文中通过示例代... 目录一、os.stat().st_size二、os.path.getsize()三、函数封装一、os

禁止平板,iPad长按弹出默认菜单事件

通过监控按下抬起时间差来禁止弹出事件,把以下代码写在要禁止的页面的页面加载事件里面即可     var date;document.addEventListener('touchstart', event => {date = new Date().getTime();});document.addEventListener('touchend', event => {if (new

MVC(Model-View-Controller)和MVVM(Model-View-ViewModel)

1、MVC MVC(Model-View-Controller) 是一种常用的架构模式,用于分离应用程序的逻辑、数据和展示。它通过三个核心组件(模型、视图和控制器)将应用程序的业务逻辑与用户界面隔离,促进代码的可维护性、可扩展性和模块化。在 MVC 模式中,各组件可以与多种设计模式结合使用,以增强灵活性和可维护性。以下是 MVC 各组件与常见设计模式的关系和作用: 1. Model(模型)

MFC中App,Doc,MainFrame,View各指针的互相获取

纸上得来终觉浅,为了熟悉获取方法,我建了个SDI。 首先说明这四个类的执行顺序是App->Doc->Main->View 另外添加CDialog类获得各个指针的方法。 多文档的获取有点小区别,有时间也总结一下。 //  App void CSDIApp::OnApp() {      //  App      //  Doc     CDocument *pD

Caused by: android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.B

一个bug日志 FATAL EXCEPTION: main03-25 14:24:07.724: E/AndroidRuntime(4135): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.syyx.jingubang.ky/com.anguotech.android.activity.Init

自定义view中常用到哪些方法作用分别是什么

目录 构造函数onMeasure(int widthMeasureSpec, int heightMeasureSpec)onDraw(Canvas canvas)onLayout(boolean changed, int left, int top, int right, int bottom)onTouchEvent(MotionEvent event)onSizeChanged(int

INDEX+SMALL+IF+ROW函数组合使用解…

很多人在Excel中用函数公式做查询的时候,都必然会遇到的一个大问题,那就是一对多的查找/查询公式应该怎么写?大多数人都是从VLOOKUP、INDEX+MATCH中入门的,纵然你把全部的多条件查找方法都学会了而且运用娴熟,如VLOOKUP和&、SUMPRODUCT、LOOKUP(1,0/....,但仍然只能对这种一对多的查询望洋兴叹。   这里讲的INDEX+SMALL+IF+ROW的函数组合,

android.database.CursorIndexOutOfBoundsException: Index 5 requested, with a size of 5

描述: 01-02 00:13:43.380: E/flyLog:ChatManager(963): getUnreadChatGroupandroid.database.CursorIndexOutOfBoundsException: Index 5 requested, with a size of 5 01-02 00:13:43.380: E/flyLog:ChatManager(

java中的length与length()与size()

正确用法 Array.length int[] arr = {1,2,3};int x = arr.length;//arr.length = 3 String.length() String s = "123";int x = s.length();//s.length() = 3 Collection.size() ArrayList<Integer> list = n

android 动画 ——视图动画(View Animation)

android动画分为视图动画(View Animation)、属性动画(Property Animation) 想看属性动画(Property Animation):请移步至http://blog.csdn.net/u013424496/article/details/51700312 这里我们来说下视图动画(View Animation)的纯代码写法,还有一种是xml调用, 对于xml调