ios 类似QQ登录成功后的提示框

来源:互联网 发布:java md5加密 编辑:程序博客网 时间:2024/06/02 14:33

效果如下:



- (void)showMessage:(NSString *)message{    UIWindow * window = [UIApplication sharedApplication].keyWindow;    UIView *showview =  [[UIView alloc]init];    showview.backgroundColor = [UIColor blackColor];    showview.frame = CGRectMake(1, 1, 1, 1);    showview.alpha = 1.0f;    showview.layer.cornerRadius = 5.0f;    showview.layer.masksToBounds = YES;    showview.frame = CGRectMake((kDEVICEWIDTH - 90 )/2, (kDEVICEHEIGHT-90)/2.0 , 90, 90);    [window addSubview:showview];        UIImageView *_imageView = [[UIImageView alloc]init];    [_imageView setFrame:CGRectMake((90 - 30)/2.0, 20, 30, 30)];    _imageView.image = [UIImage imageNamed:@"toast_success"];    [showview addSubview:_imageView];            UILabel *label = [[UILabel alloc]init];    CGSize LabelSize = [message sizeWithFont:[UIFont systemFontOfSize:17] constrainedToSize:CGSizeMake(290, 9000)];    label.frame = CGRectMake(10, 60, LabelSize.width, LabelSize.height);    label.text = message;    label.textColor = [UIColor whiteColor];    label.textAlignment = 1;    label.backgroundColor = [UIColor clearColor];    label.font = [UIFont boldSystemFontOfSize:15];    [showview addSubview:label];        [UIView animateWithDuration:2 animations:^{        showview.alpha = 0;    } completion:^(BOOL finished)     {         [showview removeFromSuperview];                  MyOrderViewController *_viewController = [[MyOrderViewController alloc] init];         _viewController.backViewConTrollerType = @"ViewConTroller";         [self.navigationController pushViewController:_viewController animated:YES];     }];}


0 0
原创粉丝点击