码迷,mamicode.com
首页 > 其他好文 > 详细

【代码笔记】轮询弹出框

时间:2016-04-26 09:40:47      阅读:114      评论:0      收藏:0      [点我收藏+]

标签:

一,效果图。

技术分享

二,工程图。

技术分享

三,代码。

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.
}
技术分享

 

 

 
 

【代码笔记】轮询弹出框

标签:

原文地址:http://www.cnblogs.com/yang-guang-girl/p/5433713.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!