第三方收集

1.MarqueeLabel

主要用来超长文本自动滚动显示的

MarqueeLabel *marqueeLabel = [[MarqueeLabel alloc]initWithFrame:CGRectMake(0, 200, self.view.bounds.size.width, 50) duration:9 andFadeLength:65.0];

[marqueeLabel setTextColor:[UIColor whiteColor]];

[marqueeLabel setText:contentStr];

marqueeLabel.marqueeType = MLContinuous;

marqueeLabel.animationCurve = UIViewAnimationOptionCurveEaseInOut;

[self.view addSubview:marqueeLabel];

2.WebViewJavascriptBridge


在iOS6之前这个框架一直用着很好,iOS7以后苹果引用了JavaScriptCore框架,非常好用,然而我还没有会用,如果你的App需要兼容iOS6之前系统WebViewJavascriptBridge还是很好用的

使用cocoaPods导入WebViewJavascriptBridge时自动引入了jsonkit框架,编译的时候一堆关于isa的报错,只要按照报错提示改了就可以了,WebViewJavascriptBridge具体使用在网上一搜都是用法

/****现将webView与WebViewJavascriptBridge建立好关联***/

if (_bridge) {

return;

}

_webView = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];

_webView.scrollView.scrollEnabled = YES;

_webView.delegate = self;

_webView.backgroundColor = [UIColor whiteColor];

[self.view addSubview:_webView];

[WebViewJavascriptBridge enableLogging];

_bridge = [WebViewJavascriptBridge bridgeForWebView:_webView webViewDelegate:self handler:^(id data, WVJBResponseCallback responseCallback) {

responseCallback(@"success");

}];

/***双方的沟通***/

js调用oc代码,双方定义好方法名testObjcCallback

[_bridge registerHandler:@"testObjcCallback" handler:^(id data, WVJBResponseCallback responseCallback) {

NSLog(@"testObjcCallback called: %@", data);//data为js传过来的值

responseCallback(@"Response from testObjcCallback");//向js回传

}];

oc调用js代码

id data = @{ @"33333": @"4554554554" };

[_bridge callHandler:@"testJavascriptHandler" data:data responseCallback:^(id response) {

NSLog(@"testJavascriptHandler 33333 responded: %@", response);//通过response可以接受js那边的返回值

}];

oc向js穿值

//需要返回值

[_bridge send:@"1111111" responseCallback:^(id response) {

NSLog(@"222222: %@", response);//response接受返回值

}];

//不需要返回值

[_bridge send:@"A string sent from ObjC after Webview has loaded."];

demo地址:https://github.com/tuwanli/WEBInteraction

3.HMSegmentedControl

用来做页面切换的

先看下效果


举个小例子

- (void)viewDidLoad {

[super viewDidLoad];

// Do any additional setup after loading the view, typically from a nib.

_titleArr = @[@"标题一",@"标题二",@"标题三",@"标题四",@"标题五",@"标题六",@"标题七",@"标题八"];

self.view.backgroundColor = [UIColor whiteColor];

UIView *headerView =[[UIView alloc]initWithFrame:CGRectMake(0, self.view.bounds.size.height-100, [UIScreen mainScreen].bounds.size.width, 40)];

[self.view addSubview:headerView];

_segmentControl = [[HMSegmentedControl alloc]initWithSectionTitles:_titleArr];

_segmentControl.autoresizingMask = UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleWidth;

_segmentControl.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 40);

_segmentControl.selectionStyle = HMSegmentedControlSelectionStyleFullWidthStripe;

_segmentControl.backgroundColor = [UIColor clearColor];

_segmentControl.titleTextAttributes = @{NSForegroundColorAttributeName: [UIColor whiteColor],NSFontAttributeName:[UIFont boldSystemFontOfSize:14]};

_segmentControl.selectionIndicatorHeight = 3.0f;

_segmentControl.selectionIndicatorColor = [UIColor whiteColor];

_segmentControl.selectedTitleTextAttributes = @{NSForegroundColorAttributeName: [UIColor whiteColor],NSFontAttributeName:[UIFont boldSystemFontOfSize:14]};

_segmentControl.selectionStyle = HMSegmentedControlSelectionStyleFullWidthStripe;

_segmentControl.selectionIndicatorLocation = HMSegmentedControlSelectionIndicatorLocationDown;

[_segmentControl addTarget:self action:@selector(segmentedControlChangedValue:) forControlEvents:UIControlEventValueChanged];

_segmentControl.shouldScrollFlag = YES;

_segmentControl.backgroundColor = [UIColor redColor];

_segmentControl.selectedSegmentIndex = 0;

[headerView addSubview:_segmentControl];

//    [self.view addSubview:_segmentControl];

_scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, self.view.bounds.size.height-60, self.view.bounds.size.width, 60)];

_scrollView.showsVerticalScrollIndicator = NO;

_scrollView.contentSize = CGSizeMake(_titleArr.count*[UIScreen mainScreen].bounds.size.width, 0);

_scrollView.pagingEnabled = YES;

_scrollView.delegate = self;

[self.view addSubview:_scrollView];

CGFloat width = self.view.bounds.size.width-10;

for (int i=0; i<_titleArr.count; i++) {

UIView *view = [[UIView alloc]initWithFrame:CGRectMake(5*(2*i+1)+width*i, 0,width, 60)];

view.backgroundColor = [UIColor purpleColor];

[_scrollView addSubview:view];

}

}

#pragma mark - 顶层的类的点击事件

- (void)segmentedControlChangedValue:(HMSegmentedControl *)segmentedControl

{

if (_currentIndex != segmentedControl.selectedSegmentIndex) {

[_scrollView setContentOffset:CGPointMake((_scrollView.frame.size.width) * segmentedControl.selectedSegmentIndex, 0) animated:YES];

_currentIndex = segmentedControl.selectedSegmentIndex;

}

}

4.SDCycleScrollView

这个大部分人都用过吧,用来做无限轮播的,也很好用,这个网上很多说明的具体不多说了

5.RatingBar

用来评论星级


代码很简单

RatingBar *ratingBar = [[RatingBar alloc] initWithFrame:CGRectMake(100, self.view.bounds.size.height-200, 20 * 5 + 12.5 * 4, 20)];

ratingBar.isIndicator = NO;

[ratingBar setImageDeselected:@"inquiry_star_normal" halfSelected:nil fullSelected:@"inquiry_star_click" andDelegate:self];

[self.view addSubview:ratingBar];

6.RFViewController

UICollectionView的一种布局,具体的看看吧https://github.com/tuwanli/RFQuiltLayout

7.SMPageControl

自定义UIPageControl的外观,包括形状、大小、间距等,也可以用图片代替UIPageControl上的小圆点。http://www.oschina.net/p/SMPageControl

8.OHAlertView/STAlertView

弹框效果:https://github.com/AliSoftware/OHAlertView-OHActionSheet//OHAlertView

http://www.oschina.net/p/stalertview/similar_projects//STAlertView

9.ViewDeck

https://github.com/tuwanli/ViewDeck左右滑出菜单控件

10.appirater

提示用户评分:https://github.com/tuwanli/appirater

11.PaperFold作的iOS

滑动折叠的效果https://github.com/tuwanli/PaperFold-for-iOS

12.TSMessages

*信息提示**https://github.com/toursprung/TSMessages

13. MGBox2

https://github.com/tuwanli/MGBoxKit

*简单,快速的iOS表格,网格

14.[MWPhotoBrowser

https://github.com/mwaterfall/MWPhotoBrowser图片浏览器

15.OHAttributedLabel

*富文本标签https://github.com/AliSoftware/OHAttributedLabel

16. DCRoundSwitch

*自定义的UISwitch https://github.com/domesticcatsoftware/DCRoundSwitch

17.PHFComposeBarView

短信输入框*https://github.com/fphilipe/PHFComposeBarView

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 194,088评论 5 459
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 81,715评论 2 371
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 141,361评论 0 319
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 52,099评论 1 263
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 60,987评论 4 355
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 46,063评论 1 272
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 36,486评论 3 381
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 35,175评论 0 253
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 39,440评论 1 290
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 34,518评论 2 309
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 36,305评论 1 326
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 32,190评论 3 312
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 37,550评论 3 298
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 28,880评论 0 17
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,152评论 1 250
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 41,451评论 2 341
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 40,637评论 2 335

推荐阅读更多精彩内容