经常碰到一些项目功能未全部开发完整需要上线的app,那么第一要做的事情,就是在提交appstore的app界面的审核信息的备注一栏需要文字说明,中文即可。然后就是工程里给用户比较好的提示功能未开发,android有吐司,比较适合。ios的alertview自定义比较麻烦,下面的方法就可以比较好的满足你的需求,类似android的totast。

-(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;
[window addSubview:showview];

UILabel *label = [[UILabel alloc]init];CGSize LabelSize = [message sizeWithFont:[UIFont systemFontOfSize:17] constrainedToSize:CGSizeMake(290, 9000)];label.frame = CGRectMake(10, 5, 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];showview.frame = CGRectMake((SCREEN_WIDTH - LabelSize.width - 20)/2, SCREEN_HEIGHT - 100, LabelSize.width+20, LabelSize.height+10);[UIView animateWithDuration:1.5 animations:^{    showview.alpha = 0;} completion:^(BOOL finished) {    [showview removeFromSuperview];}];

}

调用示例
[self showMessage:@”正在开发,敬请期待。”]

说明:
CGSize LabelSize = [message sizeWithFont:[UIFont systemFontOfSize:17] constrainedToSize:CGSizeMake(290, 9000)]; 这个方法已经被弃用了,但是还是可以使用,如果你有变异洁癖的话,可以替换成如下代码
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init];
paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;
NSDictionary *attributes = @{NSFontAttributeName:[UIFont systemFontOfSize:12], NSParagraphStyleAttributeName:paragraphStyle.copy};
CGSize labelSize = [self.shopModel.address boundingRectWithSize:CGSizeMake(KScreenWidth-20, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:attributes1 context:nil].size;

更多相关文章

  1. 配置android时出现path问题,因为路径有中文,完美解决方法
  2. Android快速实现地图功能(不仅快!而且小!)
  3. 详解Android进程保活的方法
  4. Phone Gap开发二:开发一个Phone Gap插件
  5. BroadcastReceiver、EventBus的优缺点
  6. Android(安卓)Bottom Sheet详解
  7. Android实现简单的音乐播放
  8. Android--Handler的使用方法:在子线程中更新界面
  9. 官宣:微软Cortana或将退出Android/iOS两大平台

随机推荐

  1. android 特殊用法琐碎二
  2. 初识Android之(一)-自定义标题栏控件
  3. android 通过php post 向mysql数据库写入
  4. Android(安卓)官方自带侧滑菜单DrawerLay
  5. Android FFmpeg 脚本编译静态库
  6. 简单几段代码实现窗口抖动
  7. gerrit 常用命令记录
  8. Android获取Theme的背景颜色
  9. android学习的网址
  10. android camera2 image 中获得的yuv数据