美文网首页
开发问题笔记(十一)

开发问题笔记(十一)

作者: Kevin_wzx | 来源:发表于2019-05-13 16:41 被阅读0次

目录

1.定义cell选中的颜色

1.定义cell选中的颜色

2.使用UIWebView需打开联网权限

使用UIWebView打开隐私政策的URL,需要plist文件设置联网权限,方可正常加载网页。权限为:App Transport Security Settings(Dictionary)、里面:Allow Arbitrary Loads(Boolean)为YES

3.Xcode运行真机,手机版本太低,将系统版本调整低一些尝试

4.计算并清除App缓存

  • 计算缓存:
NSString *libPath = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES)[0];
CGFloat fileSize=[self folderSizeAtPath:libPath];
- (float ) folderSizeAtPath:(NSString*) folderPath{
    NSFileManager* manager = [NSFileManager defaultManager];
    if (![manager fileExistsAtPath:folderPath]) return 0;
    NSEnumerator *childFilesEnumerator = [[manager subpathsAtPath:folderPath] objectEnumerator];
    NSString* fileName;
    long long folderSize = 0;
    while ((fileName = [childFilesEnumerator nextObject]) != nil){
        NSString* fileAbsolutePath = [folderPath stringByAppendingPathComponent:fileName];
        folderSize += [self fileSizeAtPath:fileAbsolutePath];
    }
    return folderSize/(1024.0*1024.0);
}
- (long long)fileSizeAtPath:(NSString*) filePath{
    NSFileManager* manager = [NSFileManager defaultManager];
    if ([manager fileExistsAtPath:filePath]){
        return [[manager attributesOfItemAtPath:filePath error:nil] fileSize];
    }
    return 0;
}


  • 清除缓存:
- (void)action:(id)sender
{
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
    NSString *path = [paths lastObject];
    
    NSArray *files = [[NSFileManager defaultManager] subpathsAtPath:path];
    
    for (NSString *p in files) {
        NSError *error;
        NSString *Path = [path stringByAppendingPathComponent:p];
        if ([[NSFileManager defaultManager] fileExistsAtPath:Path]) {
            //清理缓存,保留Preference,里面含有NSUserDefaults保存的信息
            if (![Path containsString:@"Preferences"]) {
                [[NSFileManager defaultManager] removeItemAtPath:Path error:&error];
            }
        }else{
            
        }
    }
}

5.iOS开发之设置UITextField的占位文字颜色三种方式

https://www.jianshu.com/p/a5a64ca46cbe

6.iOS开发之获取父控制器

https://www.jianshu.com/p/766020a71435

7.Xcode报错(自定义颜色类)

导入<UIKit/UIKit.h>

8.好用的UI框架QMUI_iOS

demo:https://github.com/Tencent/QMUI_iOS
功能列表:https://qmuiteam.com/ios/documents/

9.苹果系统原生弹框分享

// 苹果原生系统分享
- (void)shareBtnclick {
    
    NSString *textToShare = _textView.text;
    NSURL *urlToShare = [NSURL URLWithString:@"http://www.baidu.com"];// 分享后打开的链接
    NSArray *activityItems = @[textToShare,urlToShare];
    UIActivityViewController *activity = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
    activity.excludedActivityTypes = @[UIActivityTypeMail,UIActivityTypePostToTwitter,UIActivityTypeMessage,UIActivityTypePrint,UIActivityTypeCopyToPasteboard,UIActivityTypeAssignToContact,UIActivityTypeAddToReadingList,UIActivityTypePostToFlickr,UIActivityTypePostToVimeo];//,UIActivityTypePostToTencentWeibo,UIActivityTypeAirDrop,UIActivityTypeOpenInIBooks
    UIPopoverPresentationController *popover = activity.popoverPresentationController;
    if (popover) {
        //popover.sourceView = self.shareView;
        popover.permittedArrowDirections = UIPopoverArrowDirectionUp;
    }
    [self presentViewController:activity animated:YES completion:NULL];
}

10.iOS UIAlertController中Message和Title文字属性设置

https://www.jianshu.com/p/b84e1bc81666

11.iOS开发rightBarButtonItem在ios11之前不显示

https://blog.csdn.net/ly410726/article/details/82426667

12.去评价、打电话

去评价:
NSString * urlStr = [NSString stringWithFormat: @"https://itunes.apple.com/cn/app/id%@?mt=8",@"1477638810"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlStr]];
打电话:
NSMutableString *str = [[NSMutableString alloc]initWithFormat:@"tel:%@",@"18628596319"];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];

13.修改tapbar原生字体颜色、文字样式、字体大小

字体颜色:
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:ssRGBOK,NSForegroundColorAttributeName, nil] forState:UIControlStateSelected];

文字样式:
NSMutableDictionary *textAttrs  = [NSMutableDictionary dictionary];
textAttrs[NSForegroundColorAttributeName] = [UIColor blackColor];
NSMutableDictionary *selectTextAttrs = [NSMutableDictionary dictionary];
selectTextAttrs[NSForegroundColorAttributeName] = [UIColor brownColor];
[homeview.tabBarItem setTitleTextAttributes:textAttrs forState:UIControlStateNormal];
[homeview.tabBarItem setTitleTextAttributes:selectTextAttrs forState:UIControlStateSelected];
// 设置tabbaritem 的title
navigation.tabBarItem.title = itemTitles[i];

字体大小:
// 设置字体大小只能在正常状态下设置,所以用了两个字典
NSMutableDictionary *textSizeDic = [NSMutableDictionary dictionary];
textSizeDic[NSFontAttributeName] =  [UIFont systemFontOfSize:13.6];
[[UITabBarItem appearance] setTitleTextAttributes:textSizeDic forState:UIControlStateNormal];

14.后端服务平台Bmob

https://www.bmob.cn/

15.iOS组件化路由框架wisdomNeighbor

相关链接:https://github.com/AZlinli/wisdomNeighbor
iOS组件化-路由设计分析:https://juejin.im/post/6847902224744448014
补充-iOS 列表界面如何优雅实现模块化与动态化:https://www.jianshu.com/p/f0a74d5744b8

16.QMUI提高项目UI开发效率的组件

官网:https://qmuiteam.com/ios
项目:https://github.com/Tencent/QMUI_iOS

17.JHChart iOS图表工具库详解

https://www.cnblogs.com/ToBeTheOne/p/6180031.html

18.App预审质量测试服务

https://wetest.qq.com/auth/login

19.百海项目

小熊篮球报名助手:https://pan.baidu.com/s/17ISeC77Cdgc-jcC4VQvN3Q
大学教室申请:https://pan.baidu.com/s/1I2MG653vTMTlpHP64FNqxA

20.由于PCH文件路径没设置好引起的错误

图片.png 图片.png 图片.png

21.App上传失败报错问题No accounts with app store connect access have been found for the team

图片.png

先查看是否是证书或者账号的问题,是的话就解决证书或者账号。证书啥的没有问题就退出Xcode,重启一下Xcode重新打包一般就可以了

22.融云聊天

博客文档:
https://blog.csdn.net/boring_cat/article/details/51006974
https://www.jianshu.com/p/eabfb0a93cf9

融云官网及文档:
https://www.rongcloud.cn/
https://www.rongcloud.cn/docs/ios.html

23.Xcode的各种版本下载

https://developer.apple.com/download/more/

24.iOS值类型和引用类型的区别

https://www.jianshu.com/p/ec52b97b5382

25.为什么不能用 copy 修饰 NSMutableArray ?

https://www.jianshu.com/p/a3ed2ee9f006

26.类别(category)与扩展(extension)的区别?

https://www.cnblogs.com/stevenwuzheng/p/8205321.html

27.类方法与实例方法区别

https://www.jianshu.com/p/05f8c9fc2a65

28.面向过程与面向对象的区别

29.部分名称的区分

对象分为实例对象和类对象;

30.多任务合并的网络请求处理

相关文章

网友评论

      本文标题:开发问题笔记(十一)

      本文链接:https://www.haomeiwen.com/subject/pedraqtx.html