• 自学知识(五)


    1.网络请求显示,请求成功显示,请求失败隐藏:

    //显示状态栏的网络指示器

        [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;

     

    2.是否显示引导页:

     1 //是否显示引导页
     2 -(void)showGuiView {
     3     
     4     //获得当前版本号
     5     NSString *currentVersion = [NSBundle mainBundle].infoDictionary[@"CFBundleShortVersionString"];
     6     //沙盒版本号
     7     NSString *lastVersion = [[NSUserDefaults standardUserDefaults] stringForKey:@"CFBundleShortVersionString"];
     8     
     9     if (![currentVersion isEqualToString:lastVersion]) {
    10         XFGuideView *guideView = [XFGuideView guideView];
    11         guideView.frame = self.window.bounds;
    12         [self.window addSubview:guideView];
    13         
    14         [[NSUserDefaults standardUserDefaults] setObject:currentVersion forKey:@"CFBundleShortVersionString"];
    15         //马上写入沙盒
    16         [[NSUserDefaults standardUserDefaults] synchronize];
    17         
    18     }
    19 }

    3.内存警告停止下载图片:

    1 //当收到Received memory warning.会调用次方法
    2 -(void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
    3     SDWebImageManager *mgr = [SDWebImageManager sharedManager];
    4     //取消下载
    5     [mgr cancelAll];
    6     //清空缓存
    7     [mgr.imageCache clearMemory];
    8 
    9 }

    4.在子类化单元格类中:

    // 从队列里面复用时调用

    - (void)prepareForReuse {

        

        [super prepareForReuse];

        [_videoView reset];

        [_voiceView reset];

    }

     

    5.UIMenuController的使用:

    -(IBAction)panGestureTop:(UILongPressGestureRecognizer *)longPress
    
    02.{
    03. 
    04.UIMenuItem * itemPase = [[UIMenuItem alloc] initWithTitle:@"复制" action:@selector(copyimage)];
    05.UIMenuItem * itemTrans = [[UIMenuItem alloc] initWithTitle:@"转发" action:@selector(trans)];
    06.UIMenuItem * itemCollect = [[UIMenuItem alloc] initWithTitle:@"收藏" action:@selector(collect)];
    07.UIMenuItem * itemJoin = [[UIMenuItem alloc] initWithTitle:@"加入" action:@selector(join)];
    08. 
    09.UIMenuController * menuController = [UIMenuController sharedMenuController];
    10.[menuController setMenuItems: @[itemPase,itemCollect,itemTrans,itemJoin]];
    11. 
    12.CGPoint location = [longPress locationInView:[longPress view]];
    13.CGRect menuLocation = CGRectMake(location.x, location.y, 0, 0);
    14.[menuController setTargetRect:menuLocation inView:[longPress view]];
    15.menuController.arrowDirection = UIMenuControllerArrowDown;
    16. 
    17.[menuController setMenuVisible:YES animated:YES];
    18. 
    19.}

    6.对界面一样的可以复用控制器,简化代码,在控制器设置三目条件即可.

     每天进步一点点!!!

  • 相关阅读:
    Python:Day02
    Python:Day01
    学习Python的第二天
    学习Python的第一天
    MySQL插入中文数据乱码问题
    MySQL数据库应用(11)DML之表和字段
    MySQL数据库应用(10)DML之修改表中的记录
    MySQL数据实战(初步增量恢复)
    MySQL数据库应用(9)DQL之select知识
    MySQL数据库应用(8)DML语句之insert知识
  • 原文地址:https://www.cnblogs.com/pengsi/p/5355744.html
Copyright © 2020-2023  润新知