学习PopView

仲孙毅
2023-12-01

IOS 6.0 XIB文件多了属性use Autolayout,可能造成不必要的自动适配导致视图变形的麻烦,建议去掉

弹出式视图PopView

参考代码

CQMFloatingController(自定义弹出视图)

How to Use

  1. Add all files in CQMFloatingController/Classes to your project
  2. Write code as below:
// Import a required class
#import "CQMFloatingController.h"

- (void)show {
    // Prepare content view controller
    SomeViewController *viewController = [[[SomeViewController alloc] init] autorelease];

    // Get shared floating controller, and customize if needed
    CQMFloatingController *floatingController = [CQMFloatingController sharedFloatingController];
    [floatingController setFrameColor:[UIColor orangeColor]];

    // Show floating controller with content
    UIWindow *window = [[UIApplication sharedApplication] keyWindow];
    UIView *rootView = [window.rootViewController view];
    [floatingController showInView:rootView
         withContentViewController:viewController
                          animated:YES];
}

    // 1.init the distance
    RegisterViewController *registerviewController=[[RegisterViewController alloc]init];
    
    // 2. Get shared floating controller
	CQMFloatingController *floatingController = [CQMFloatingController sharedFloatingController];

	[floatingController setFrameSize:CGSizeMake(600, 800)];//动态设置弹框的frame
	[floatingController setFrameColor:[UIColor orangeColor]];//动态设置视图的颜色
    // 3. Show floating controller with specified content
    
	[floatingController presentWithContentViewController:registerviewController animated:YES];



 类似资料: