设为首页 加入收藏

TOP

【代码笔记】iOS-轮询弹出框
2017-10-13 10:24:25 】 浏览:4967
Tags:代码 笔记 iOS-

一,效果图。

二,工程图。

三,代码。

RootViewController.m

复制代码
#import "RootViewController.h"
//加入弹出框的头文件
#import "MPNotificationView.h"

@interface RootViewController ()

@end

@implementation RootViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.title=@"RootViewController";
    
    //弹出框前面有图片
      [self showWithFrame];
    //弹出框可以进行点击
      [self showWithTouch];
   
}
#pragma -mark -可以点击的,点击后消息,并且可以在点击后添加事件
-(void)showWithTouch
{
    [MPNotificationView notifyWithText:@"李华:"
                                detail:@"今天有时间吗?"
                         andTouchBlock:^(MPNotificationView *notificationView) {
                             
                             UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"提醒" message:@"已点击弹出框" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
                             [alert show];
                             
                         }];

}
#pragma -mark -弹出框在前面有一张图片,然后,5.0s后自己会主动消失。没到5.0s点击的时候也会消失。
-(void)showWithFrame
{
    [MPNotificationView notifyWithText:@"李华:"
                                detail:@"今天有时间吗?"
                                 image:[UIImage imageNamed:@"1.jpeg"]
                           andDuration:5.0];

}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
复制代码

 

 

 
 
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇推荐关注模块的实现2 下一篇iOS 启动图添加后没有效果

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目