GithubHelp home page GithubHelp logo

cryboyofyu / xyweibocells Goto Github PK

View Code? Open in Web Editor NEW
19.0 2.0 1.0 18.45 MB

自定义类似微博界面(图文混排,优化流畅性,高度封装)

License: MIT License

Ruby 0.06% Objective-C 88.19% Shell 0.69% C 0.03% Objective-C++ 7.66% C++ 3.37%

xyweibocells's Introduction

XYWeiboCells

自定义类似微博界面(图文混排,优化流畅性,高度封装)


个人邮箱:[email protected] 我的CSDN:http://blog.csdn.net/cry__boy

QQ技术群:549943887



1.高度优化cell流畅度

2.预缓存UI高度

3.懒加载数据

4.高度封装接口

效果图
image image image

添加方法:cocoapods

pod ‘XYWeiboCells’

依赖库:'XYJGG','YYImage','IDMPhotoBrowser','YYText'

1.方法:

 _xyTVController = [[XYTVController alloc]init]; 

_xyTVController.xy_dataMArr = _xyDataMArr;

 _xyTVController.view.frame = CGRectMake(0,64, xy_width, xy_height - 64); 

_xyTVController.xy_delegate = self; _xyTVController.xy_numberOfLine = 5; 

_xyTVController.tableView.backgroundColor = xy_grayColor;    [

self.view addSubview:_xyTVController.tableView];    

遵守协议:《XYTVControllerDelegate》 


2.对接接口:(头像,cell,图片放大,点赞,转发,评论)

 #pragma mark-lv ---------------------代理位置------------------------------
(void)xy_cellSelectedDelegate:(id)sender withIndexPath:(NSIndexPath *)indexPath{ NSLog(@"\n进入了详情页\n"); }

(void)xy_tableViewCellHeadTap:(id)sender withObject:(id)object{ NSLog(@"\n进入了个人页\n"); }

(void)xy_tableViewCellPraiseTap:(id)sender withObject:(id)object{

[[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(xy_praiseButtonClick:) object:object]; [self performSelector:@selector(xy_praiseButtonClick:) withObject:object afterDelay:0.3]; }

(void)xy_praiseButtonClick:(id)sender{

XYTVCell * cell = sender; XYCellFrame * frame;

frame = [_xyTVController.xy_statusFrame objectAtIndex:cell.tag];

[self xy_requestPraiseWithDynamicId:[NSString stringWithFormat:@"%@",frame.xy_cellItem.itemId] withCell:cell];

}

(void)xy_tableViewCellCommentTap:(id)sender withObject:(id)object { NSLog(@"\n进入详情页\n");
}

(void)xy_tableViewCellTranspondTap:(id)sender withObject:(id)object{ NSLog(@"\n转发事件触发了\n"); XYTVCell * cell = object;
 LVSendStatusVC * lvSendStatusVC = [[LVSendStatusVC alloc]init]; 

 lvSendStatusVC.hidesBottomBarWhenPushed = YES; 

lvSendStatusVC.lvTitle = @"转发"; 

 lvSendStatusVC.textViewBgViewH = kLV(85); 

 lvSendStatusVC.isShowNewsBgView = YES; 

 lvSendStatusVC.lvItem = cell.lvNewsFrame.lvNewsItem; 

 if(_categoryView.lvSelectedTag !=1){

  [self.navigationController pushViewController:lvSendStatusVC animated:YES]; //
 }else{ // [LVHUD showCustomHUDWithBgView:self.view withTitle:@"暂未开通此功能!"]; // } }

(void)xy_tableViewCellTranspondedBgViewTap:(id)sender withObject:(id)object{ NSLog(@"\n转发事件触发了\n"); }

(void)lvTableViewCellArrowBtnClick:(id)sender withObject:(id)object{ XYTVCell * cell = object; // _selectedDynamicId = cell.lvNewsFrame.lvNewsItem.itemId; // [_lvMoreActionSheet showInView:self.view]; }

(void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. }

pragma mark-xy--------------------------点击事件位置------------------------------

(void)xy_requestPraiseWithDynamicId:(NSString )dynamicId withCell:(XYTVCell)cell{

cell.xy_praiseBtn.selected = YES; NSInteger praiseValue = [cell.xy_praiseBtn.currentTitle integerValue];

XYCellFrame * xyFrame = [_xyTVController.xy_statusFrame objectAtIndex:cell.tag];

xyFrame.xy_cellItem.itemPraiseStr = [NSString stringWithFormat:@"%ld",(long)praiseValue]; xyFrame.xy_cellItem.itemIsPraisedByMe = @"1";

 praiseValue ++; [cell.xy_praiseBtn setTitle:[NSString stringWithFormat:@"%ld",(long)praiseValue] forState:UIControlStateNormal];

} 


欢迎大家提意见,一起交流学习,会根据大家的反馈及时更新。谢谢!别忘了点个星哦~

如果小弟的一点点薄力可以给大家带来便利,小弟三生有幸!会再接再厉!您的支持就是我的动力!

还有《自定义表情键盘》《自定义九宫格》《消息角标》《高仿微信群组界面》,感兴趣的要关注哦!

xyweibocells's People

Contributors

cryboyofyu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

calmheart

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.