uitableview

How to make custom TableViewCell with initWithStyle after 3.0

孤街醉人 提交于 2020-01-23 07:52:56
问题 I am trying to have custom TableViewCell with initWithStyle, since it says initWithFrame is deprecated after 3.0. Everything worked fine with initWithFrame before. Is there any tutorials or sample code available for this? Thanks. 回答1: I have subclassed UITableViewCell then override the initWithStyle method. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { self.selectionStyle

How to make custom TableViewCell with initWithStyle after 3.0

99封情书 提交于 2020-01-23 07:52:11
问题 I am trying to have custom TableViewCell with initWithStyle, since it says initWithFrame is deprecated after 3.0. Everything worked fine with initWithFrame before. Is there any tutorials or sample code available for this? Thanks. 回答1: I have subclassed UITableViewCell then override the initWithStyle method. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { self.selectionStyle

Admob ads not appear in footer of UITableView when keyboard is shown

為{幸葍}努か 提交于 2020-01-23 05:57:31
问题 I use this to show Admob ads on the footer of UITableView: - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { GADBannerView *sampleView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner]; if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { sampleView.hidden=true; } sampleView.adUnitID = @"myID"; sampleView.rootViewController = self; [sampleView loadRequest:[GADRequest request]]; return sampleView; } - (CGFloat)tableView:(UITableView *

Remove border in each table cell in swift

夙愿已清 提交于 2020-01-23 04:42:24
问题 I would like to remove border bottom line of each Question table rows. Another thing is that I would like to remove the left padding space in each row. How to implement it in swift iOS 9.0 . 回答1: You can remove bottom border by writing this below line in viewdidLoad, self.tblMyTable.separatorStyle = UITableViewCellSeparatorStyle.None And Remove left padding by writing this in cellForRow, cell.separatorInset = UIEdgeInsetsZero cell.layoutMargins = UIEdgeInsetsZero Update for Swift 3.0: cell?

Color alternate UITableViewCell in a UITableView?

可紊 提交于 2020-01-23 02:28:39
问题 I was trying to color alternate tableCell in a Table View using this link to color cell with this code: func colorForIndex(index: Int) -> UIColor { let itemCount = stnRepos.count - 1 let color = (CGFloat(index) / CGFloat(itemCount)) * 0.6 return UIColor(red: 0.80, green: color, blue: 0.0, alpha: 1.0) } func tableView(tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: NSIndexPath) { var count = stnRepos.count for (var i = 0; i<=count; i++) { if (i % 2 =

Changing the color of UITableViewCellDeleteConfirmationControl(Delete Button) in UITableViewCell

故事扮演 提交于 2020-01-23 01:19:13
问题 Currently I'm trying to customize delte button in UITableViewCell. Now I've got something like that: Now, all what I need is to change the color of this button, I don't want to change the behavior, or to make it absolutelly custom. I'm sure that it is possible, without creating your own controls for deleting rows in UITableView. This my code: - (void)layoutSubviews { [super layoutSubviews]; for (UIView *subview in self.subviews) { if ([NSStringFromClass([subview class]) isEqualToString:@

UITableViewCell selectedBackgroundView's color not visible when building on iOS 13

风流意气都作罢 提交于 2020-01-22 20:36:28
问题 I have given a tableview cell a color on selection in cellForRowAtIndexPath using let backgroundView = UIView() backgroundView.backgroundColor = UIColor.grey3 //custom color cell.selectedBackgroundView = backgroundView Since I am building with Xcode 11.0 the color is not propagated to the subviews of the cell anymore on an iOS 13 device or Simulator. If I build on an iOS 12.2 simulator using Xcode 11.0 it still works. Anyone has an idea what has changed to cause this behaviour? I am working

UITableViewCell selectedBackgroundView's color not visible when building on iOS 13

試著忘記壹切 提交于 2020-01-22 20:36:05
问题 I have given a tableview cell a color on selection in cellForRowAtIndexPath using let backgroundView = UIView() backgroundView.backgroundColor = UIColor.grey3 //custom color cell.selectedBackgroundView = backgroundView Since I am building with Xcode 11.0 the color is not propagated to the subviews of the cell anymore on an iOS 13 device or Simulator. If I build on an iOS 12.2 simulator using Xcode 11.0 it still works. Anyone has an idea what has changed to cause this behaviour? I am working

抖音app开发时,在录制视频添加背景音乐功能实现流程

爱⌒轻易说出口 提交于 2020-01-22 17:32:47
抖音app之所以“横扫”整个短视频领域,最主要的还是占据了短视频玩法的“先机”,其中在录制视频时添加背景音乐,是很多用户都非常喜欢的步骤,但是在 抖音app开发 时,添加背景音乐的功能也是需要技术实现的。今天就来分享下关于这一功能的大概实现流程。 1.在录制界面点击音乐,绘制UI 添加搜索框 -(UIView *)searchBg { if (!_searchBg) { _searchBg = [[UIView alloc]initWithFrame:CGRectMake(0,64+statusbarHeight,_window_width,44)]; _searchBg.backgroundColor = [UIColor whiteColor]; _search = [[UISearchBar alloc]initWithFrame:CGRectMake(0,0, _window_width,44)]; _search.backgroundImage = [PublicObj getImgWithColor:[UIColor whiteColor]]; _search.placeholder = @"搜索歌曲名称"; _search.delegate = self; UITextField *textField ; if (@available(iOS 13.0,*)) {

How to determine if the user has scrolled to the bottom of the UITableView?

我的未来我决定 提交于 2020-01-22 13:58:06
问题 How can I determine if the user has scrolled to the last cell/bottom of a UITableView? 回答1: UITableView inherits from UIScrollView, and scroll view exposes a contentOffset property (documentation here). Use this with a bit of math to determine if the contentOffset is within frame.size.height of the bottom. Update: here's a stab at a formula that will give you what you want: if(tableView.contentOffset.y >= (tableView.contentSize.height - tableView.frame.size.height)) { //user has scrolled to