大年初二研究成果

Jan 29, 2017

今天大年初二,还是不能停歇,毕竟有兴趣,马达就一直在脑袋转着,哈哈。
先介绍我之前想用不敢用的一款文本创建第三方工具:ZSSRichTextEditor

ZSSRichTextEditor

这款作用是将你输入转化为html文本,你直接就可以将它当做链接用,如:
`NSString *htmlStr = @”

\
\

This is a test of the ZSSRichTextEditor by Zed Said Studio\
\\

Dffhhhfffffgggggggggggggggggggggggguuuuuuuuuuuuuuyyttttttttggggggggggggggvvv\

baidubaidu
\
“;如果其中的<img src=\”data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAASABIAAD/4QBYR……alt=””>那么其为数据类型,data可能会很大,可能我会想办法将其作为图片传到服务器,然后再将其类型更改为地址,这样其中的数据就变小了。 使用的话,很简单,如:[self.webView loadHTMLString:self.htmlStr baseURL:nil];`
你可以自己加上头、背景啥的,一个文章便创建成功了,哈哈。
慢慢我也要学习前段知识啦,刚好之前学的React语法用得上,估计可以比较快用的顺手,嗷嗷,提供一个学习地址:大牛博客

快要睡觉了,直接贴FontAwesome学习使用代码

FAKIonIcons *starIcon = [FAKIonIcons starIconWithSize:30]; UIImage *starImage = [starIcon imageWithSize:CGSizeMake(30, 30)]; FAKFontAwesome *settingIcon = [FAKFontAwesome cogIconWithSize:30]; UIImage *settingImage = [settingIcon imageWithSize:CGSizeMake(30, 30)]; NSArray *imageArr = @[starImage,settingImage]; NSArray *selectedArr = @[starImage,settingImage]; NSArray *nameArr = @[@"",@""]; // self.label.attributedText = [starIcon attributedString]; // starIcon.drawingBackgroundColor = [UIColor blackColor]; // starIcon.drawingPositionAdjustment = UIOffsetMake(2, 2); // [starIcon removeAttribute:NSForegroundColorAttributeName]; // [starIcon setAttributes:attributes]; // [starIcon attributes]; // [starIcon addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor]];

  • 这里提一点,我将其Cocoapods导入的,然后捏,本身有.a文件,但是搜不到,于是我将其Resources文件复制到主工程的Resource下才OK,哈哈,记录一下吧

Array使用valueForKeyPath

参考:http://blog.csdn.net/binyanye1/article/details/43413333
NSArray *testArray = [NSArray arrayWithObjects:@"2.0", @"2.3", @"3.0", @"4.0", nil]; NSNumber *sum = [testArray valueForKeyPath:@"@sum.floatValue"]; NSNumber *avg = [testArray valueForKeyPath:@"@avg.floatValue"]; NSNumber *avg = [testArray valueForKeyPath:@"@max.floatValue"]; NSNumber *avg = [testArray valueForKeyPath:@"@min.floatValue"];

如果类型如下:
( { city = “Beijing”; country = “China”; }, { city = “Tokyo”; country = “Japan”; }, { city = “New York”; country = “U.S.”; } )

使用[array valueForKeyPath:@"city"];
则会得到
( “Beijing”, “Tokyo”, “New York” )
然后利用array的index:[[array valueForKeyPath:@"city"] indexOfObject:@”Beijing”];
然后用得到的index获取对象:[array objectAtIndex:[[array valueForKeyPath:@"city"] indexOfObject:@”Beijing]];

这是一个例子
NSMutableDictionary *dic=[NSMutableDictionary dictionary]; [dic setObject:@"v1" forKey:@"k1"]; [dic setObject:@"v2" forKey:@"k2"]; [dic setObject:@"v3" forKey:@"k3"]; NSArray *array=[NSArray arrayWithObjects:@"2",@"3",@"4",@"5",nil]; [dic setObject:array forKey:@"k4"]; id obj=[dic valueForKeyPath:@"k4.@sum.floatValue"]; NSLog(@"%@",[obj description]);//==14