直接代码
//
// ismyRight.h
// panGuChina
//
// Created by taogu on 15/5/9.
// Copyright (c) 2015年 com.taogucn.www. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ismyRight : UIView
@property (nonatomic, strong) UILabel * scoreLabel;
@property (nonatomic, strong) UIImageView * blackImage;
@property (nonatomic,strong) UIButton *yesButton;
@property (nonatomic,strong) UIButton *noButton;
+ (void)showString:(NSString *)string;
@end
#import "ismyRight.h"
@implementation ismyRight
- (id)initWithFrame:(CGRect)frame withTitle:(NSString *)title
{
self = [super initWithFrame:frame];
if (self) {
_blackImage =[[UIImageView alloc]initWithFrame:CGRectMake((VIEW_WIDTH - 150) / 2, VIEW_HEIGHT / 2 - 30, 120, 150)];
//self.backgroundColor =[UIColor whiteColor];
self.scoreLabel =[[UILabel alloc]initWithFrame:CGRectMake(10, 10, 100, 20)];
self.scoreLabel.text =@"您的账号在别的设备有登录请求,请确认";
self.scoreLabel.textColor =[UIColor blueColor];
self.scoreLabel.textAlignment = NSTextAlignmentCenter;
self.scoreLabel.font =[UIFont systemFontOfSize:12];
[_blackImage addSubview:self.scoreLabel];
self.yesButton =[[UIButton alloc]initWithFrame:CGRectMake(10, 40, 30, 30)];
self.yesButton.titleLabel.text =@"是";
self.yesButton.backgroundColor=[UIColor redColor];
[_blackImage addSubview:self.yesButton];
self.noButton =[[UIButton alloc]initWithFrame:CGRectMake(60, 40, 30, 30)];
self.noButton.titleLabel.text =@"否";
self.noButton.backgroundColor=[UIColor redColor];
[_blackImage addSubview:self.noButton];
[[[UIApplication sharedApplication].delegate window] addSubview:_blackImage];
}
return self;
}
//显示文字并设置大哦哦那个花
+ (void)showString:(NSString *)string
{
ismyRight *animation =[[ismyRight alloc]initWithFrame: CGRectMake((VIEW_WIDTH - 150) / 2, VIEW_HEIGHT / 2 - 30, 120, 150)withTitle:string];
// AnimationView * animation = [[AnimationView alloc] initWithFrame:CGRectMake((VIEW_WIDTH - 150) / 2, VIEW_HEIGHT / 2 - 30, 150, 60) withTitle:string];
// [animation startAnimationSeconds:seconds];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
原文地址:http://blog.csdn.net/sammyieveo/article/details/45880081