uitableview

iOS-上拉刷新下拉加载 新版MJRefresh和EGOTableViewPullRefresh

我的未来我决定 提交于 2020-03-22 12:46:02
上拉刷新下拉加载比较流行的两个第三方 MJRefresh 和 EGOTableViewPullRefresh 一.最新版的MJRefresh 首先介绍M了个J的 最新版的MJRefresh 因为他的 github 里有详细介绍,话不多说上代码 [objc] view plain copy // // ViewController.m // 新版MJRefresh Demo // // Created by Jack_Jia on 16/1/19. // Copyright © 2016年 Jack_Jia. All rights reserved. // #import "ViewController.h" #import "MJRefresh/MJRefresh.h" @interface ViewController ()<UITableViewDataSource,UITableViewDelegate> { UITableView *_tableView; NSMutableArray *_arr; } @end @implementation ViewController - ( void)viewDidLoad { [ super viewDidLoad]; self .view .backgroundColor = [UIColor purpleColor];

Remove cell when button pressed inside cell CustomTableViewCell

巧了我就是萌 提交于 2020-03-22 09:49:14
问题 Hi I'm trying to remove the cell when the checkbox is selected but the function keeps removing cell at index 0 instead of selected cell index Set up Cell with tag let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! TableViewCell let task = tasks[indexPath.row] cell.delegate = self cell.tag = indexPath.row print("The tag is \(cell.tag)") CustomTableViewCell protocol TableViewCellDelegate { func RadioTapped(_ tag: Int) } class TableViewCell: UITableViewCell {

[NSPlaceholderString initWithString:]: nil argument' on iOS13

穿精又带淫゛_ 提交于 2020-03-21 20:33:17
问题 Heres my situation i have a UICollectionView nested inside a UITableVIew the table view scrolls vertically and the collection view scrolls horizontally inside the table view. i have made the tableview as the delegate for the collection view here a code snippet: i know this code doesnt make sense cause i have removed a lot of stuff from it i just shared it for you guys to see how i set up the tableview and the collectionview in case its helpful class HomeViewController: UIViewController

UITableView汇总

心不动则不痛 提交于 2020-03-20 08:16:28
1.声明数据源数组,声明全局的TableView NSMutableArray *_dataArray; UITableView *_tableView; 2.实例化_tableView 遵守协议<UITableViewDeleate,UITableViewDataSoure> _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0,0,320,460)]; _tableView.delegate = self; _tableView.dataSoure = self; [self.view addSubView:_tableView]; 3.TableView的代理函数 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { //返回每行行高 return 0; } - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { //返回每个分区的头标题行高 return 100; } - (CGFloat)tableView:(UITableView *

UITableView滑动按钮的操作

醉酒当歌 提交于 2020-03-20 07:41:24
   一.开题   首先先创建工程, 创建工程的步骤就不一一介绍了, 前面有提过, 接下来是要在VC上创建一个tableview当然你也可以选择一个类继承于UITableView两者都可以, 这要看个人喜欢了, 这些都不是很重要, 重要的在后面呢, 也是我要说的, 敬请期待吧!    tableview上传统的delete键是这个样子的, 也就是在滑动cell的时候出来的按钮:    当然这样并不能满足我们的需求, 有时间我们还想要让delete显示为中文样式或者改变显示的文字, 那我们要怎么做呢, 不要着急下面我就来告诉大家, 首先我们应该让我们的tableview遵循代理和datasource方法(继承与tableview除外), 代码是这样字的: @interface MainViewController ()<UITableViewDataSource, UITableViewDelegate> @property (nonatomic, strong) UITableView *tableView; @end @implementation MainViewController - (void)viewDidLoad { [super viewDidLoad]; self.automaticallyAdjustsScrollViewInsets = NO; // Do

UITableView

醉酒当歌 提交于 2020-03-18 18:04:23
3 月,跳不动了?>>> 如何在UITableView中更改节标题的颜色? 编辑 : DJ-S提供 的 答案 应考虑适用于iOS 6及更高版本。 接受的答案已过时。 #1楼 不推荐在UITableViewHeaderFooterView上设置背景颜色。 请改用 contentView.backgroundColor 。 #2楼 如果您想要具有自定义颜色的标题,可以执行此操作: [[UITableViewHeaderFooterView appearance] setTintColor:[UIColor redColor]]; 这个解决方案从iOS 6.0开始运行良好。 #3楼 如果您不想创建自定义视图,还可以更改颜色(需要iOS 6): -(void) tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section { if ([view isKindOfClass: [UITableViewHeaderFooterView class]]) { UITableViewHeaderFooterView* castView = (UITableViewHeaderFooterView*) view; UIView* content =

How to make UITableViewCell adjust height to fit its content?

蹲街弑〆低调 提交于 2020-03-18 05:49:37
问题 I'm trying to make a UITableViewCell like below, which will adjust its height according to its content view. The image in the center should be as wide as the cell frame, and adjust its height proportionally. As you can see, the image in the cell doesn't display like the way I want. I tried to set the height of the UIImageView to 320.0 in override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell , but doesn't help at all. Question: how can

UITableVIew与UICollectionView带动画删除cell时崩溃的处理

大憨熊 提交于 2020-03-18 05:08:13
UITableVIew与UICollectionView带动画删除cell时崩溃的处理 -会崩溃的原因是因为没有处理好数据源与cell之间的协调关系- 效果: tableView的源码: ModelCell.h + ModelCell.m // // ModelCell.h // Set // // Created by YouXianMing on 14/11/24. // Copyright (c) 2014年 YouXianMing. All rights reserved. // #import <UIKit/UIKit.h> @class ModelCell; @protocol ModelCellDelegate <NSObject> @optional - (void)modelCellButton:(ModelCell *)cell; @end @interface ModelCell : UITableViewCell @property (nonatomic, weak) id<ModelCellDelegate> delegate; @property (nonatomic, strong) UILabel *title; @end // // ModelCell.m // Set // // Created by YouXianMing on 14/11

Pull down to show view

三世轮回 提交于 2020-03-17 11:49:07
问题 I have UITableView . I want to add a UITextField above tableView, which could be accessible by pulling tableView down. And I want to hide my textField by pulling tableView up. How can I do this? Here's what I tried: [self.messagesTableView addSubview:self.messageField]; - (UITextField*)messageField { if (!_messageField) { _messageField = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, self.messagesTableView.frame.size.width, kMessageFieldHeight)]; _messageField.autoresizingMask =

Can't reset UILabel attributedText when a UITableViewCell is reused

你离开我真会死。 提交于 2020-03-17 11:47:47
问题 The problem I'm using a UITableView to show the list of transactions of a credit card. If the transaction is a chargeback, I'm adding a strikethrough style to the label: The problem happens when that specific cell is reused. The strikethrought decoration is still there, even after resetting the text and attributedText property of the label. Below I've added the relevant parts of my code: Table view class TimelineViewController: UIViewController { private lazy var tableView: UITableView = {