Questions tagged [uitableview]

20291 questions
1

votes
2

answer
52

Views

How to access an object inside a ViewController from within a TableViewCell

I am fairly new at coding in swift and I've been trying to find a solution to my problem for the past couple days, and am not able to. I have a class named userData with various properties: class UserData { var name: String var age: Int var credits: Int = 1 ... init(name: String, age: Int) { self.n...
1

votes
2

answer
59

Views

How does UITableViewCell.SeparatorStyle.none work?

I understand it's supposed to 'remove' the separators, but that's not truly the case: If you look at the view's hierarchy, you would see _UITableViewCellSeparatorView being added as the cell's subview. The separator's isHidden property is also false. The separator's alpha is 1.0. The separator's fr...
Ray Tso
1

votes
3

answer
2.8k

Views

How do I make my UITableView Scroll?

In the following code, I push a new UITableView when I click on a button. The TableView has 25 rows. I can see the first 9 row and the 10th row got cut off. I can't scroll down to view the rest of the rows. How do I make the TableView scrollable? Thank you. - (IBAction)showListPicker:(id)sender...
atbebtg
1

votes
1

answer
2.6k

Views

Add subview to tableview which doesn't scroll

I'm using a UITableViewController and want to add a searchbar. My options are [self.tableview addSubview:searchBar] or self.tableview.tableHeaderView = searchBar Both options will scroll the searchbar along the rest of the tableview, which I understand. But is there a way to lock elements up, instea...
L. Steiner
0

votes
0

answer
18

Views

When to update tableView?

I am building a to-do list app where I use my section headers to show information about the process. through string manipulation, I show some values in there about To-do. But to always be up to date I only know the reloadData() command. But it looks really bad trying to deleteRows automatically. So...
Roman H
1

votes
4

answer
7.2k

Views

Remove spacing between UITableViewCells

I have UITableViewCells in the same section which have gaps between them. I coloured each cell's contentView background and did an NSLog to show that it's the same height as the cells. Still, there's a gap between them. They're definitely in the same section as each other. Any ideas as to what could...
Andrew
0

votes
1

answer
16

Views

Added an Autolayout to the UITableViewCell, but I see an unknown phenomenon

I have added an Autolayout to the items in the UITableViewCell, but I have an unknown error. All items added with AutoLayout will be aligned to the top left corner. If I add Auto Layout to General Label : After Build Result: General label moves to the top left corner This is true for other items as...
Enkha
1

votes
1

answer
19

Views

Firebase query is not populating array for table view. How can I resolve this issue?

I have written a firebase query that gets information from my Competition db and then loads it into my distanceData (which is of type distanceModel, a class that I created) before populating the table view. However, the table view is not being populated. Photo of Firebase db Photo of distanceModel c...
Jason Singh
1

votes
1

answer
3k

Views

layoutIfNeeded affecting table view cells

In my view controller I have a table view as a subview. When the keyboard disappears, I'm using self.view.layoutIfNeeded() to animate the table view. This goes all well except for the table view cells. The cells consists of a few labels, set up with auto layout. When the keyboard disappears, layoutI...
Hendrik Smoels
0

votes
2

answer
12

Views

How can I match Custom View's frame with TableViewCell frame properly?

I have a TableView which contains image stretched into cell and I added a view for darkening the image. Since I want to draw this view only in the beginning and not every time I scroll in table I added my codes into awakeFromNib in TableViewCell. TableViewCell.swift @IBOutlet weak var equipmentImage...
Egrimo
1

votes
3

answer
815

Views

Programmatically select UITableView cell not in current view

So it's easy to select a row that is currently in the UITableView. For example, to select the first row: [self.tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] animated:YES scrollPosition:UITableViewScrollPositionNone]; Say that I have an array that is the data source for t...
Alex
1

votes
1

answer
869

Views

Corner Radius for a Label on UItableviewCell is not applying in xcode 8

Here is my code [cell.label.layer setCornerRadius:cell.label.frame.size.width/2]; here is what I tried :- cell.label.clipsToBounds = YES; also tried :- cell.label.layer.masksToBounds = YES; also I have Imported:- #import none of these approaches works. Also I have tried it in both IOS 9 and IOS 10...
vinay
1

votes
4

answer
535

Views

How to display each elements of loop to table row?

how to return each element of loop. I mean i want display each name of this loop to row text. It is only return last element. How can i return all of this? func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cellFullname = tableview.dequeueReusableCe...
Neo Teo
1

votes
2

answer
63

Views

Multiple Custom UITableViewCell using in tableView(_cellForRowAt:)

I have some custom UITableViewCell,and would using some of them randomly. But after I register them ,it will crashed in tableView(_cellForRowAt:). Here is my code: in viewDidLoad method tableView.register(CustomACell.self, forCellReuseIdentifier: 'Identifier') tableView.register(CustomACell.self, fo...
Dean Lee
1

votes
1

answer
362

Views

Bug with FetchedResultsController after setting it to nil in viewWillDisappear

In my iOS (Swift 3, Xcode 8) Core Data app I have 2 View Controllers (CategoriesViewController and ObjectsViewController) (Both are inside the same navigation controller). Each ViewController has it's own tableView and it's own fetchResultsController to manage the results returned from Core Data req...
Adelmaer
1

votes
3

answer
162

Views

Displaying activity indicator to the right of tableview row

My tableview is having Disclosure indicator as an accessory item. The didSelectItem() call of this tableview cell performs an api call on background. So the view will need to wait until the response to show next page. I have to provide an activity indicator to the position of disclosure indicator. h...
Vaisakh KP
1

votes
1

answer
55

Views

Retain cells in UITableView in Swift?

UITableView by default reuse cells. But in my case some cells have a UITextField object and I don't want to loose its value when the cell is reused. The table has few rows so I can handle all the cells in memory. Example of code I currently use: override func viewDidLoad() { super.viewDidLoad() tabl...
Vyachaslav Gerchicov
1

votes
2

answer
64

Views

TableViewCell Nib error: loaded the nib but the view outlet was not set

Trying to create a tableView cell xib, but am stuck with the error 'loaded the nib but the view outlet was not set' I have read many posts and most say to drag the 'view' from File's Owner to the IB view. However, if you notice from the images, I do not have a 'view' as an option. I have recreate...
David Sanford
1

votes
2

answer
90

Views

How to detect button tap in a UITableViewCell which is in a UICollectionViewCell?

I'm trying to detect button tap in a UITableViewCell which is in a UICollectionViewCell. UICollectionView's delegate and dataSource is my ViewController. There is one UITableView in every UICollectionViewCell. And the UITableViewCell's delegate and dataSource is the UICollectionViewCell. I need to d...
Sercan
1

votes
4

answer
70

Views

I have a UIButton inside a CollectionViewCell which is again inside the TableViewCell.How do i navigate to next view contoller by clicking UIButton?

I have UIButton inside UICollectionViewCell which is inside UITableViewCell, I need to navigate another UIViewController on tapping that UIButton. But UINavigationController is not working inside the UICollectionViewCell. Can anybody please help? I do not find any navigationController in my code. im...
rashmi shrestha
0

votes
0

answer
8

Views

How to print uiwebview which has header and uitableview with multiple data

I am creating webview to print the data. As per my requirement half of the page contains header labels and remaining starts with uitableview which has table contents. If tableview contents are more then i need to continue those contents to next page. func createPDF(_ currentWebView: UIWebView) {...
Steve Gear
0

votes
0

answer
8

Views

My TableViewCell won't change its height according to the dynamically changing view inside of it

I have tried using UITableView.automaticDimension for both the heightForRowAt and for the estimatedHeightForRowAt with the same results of the cell not changing with a dynamically changing view. Here is some relevant code: From the view controller: func tableView(_ tableView: UITableView, heightForR...
michaeldebo
1

votes
3

answer
2.9k

Views

need help reading plist file in objective c

I have been trying read data from a plist file. this is how it is structured |term|detail(string)| my properties : @property (nonatomic, strong) NSDictionary *terms; @property (nonatomic, strong) NSArray *termKeys;//this is just a array to keep track @property (nonatomic, strong) NSString *detail; t...
meda
1

votes
0

answer
15

Views

UITableView blurred background

I have a UITableViewController (static table) to which I add a background image with (in viewDidLoad): tableView.backgroundView = UIImageView(image: UIImage(named: 'login_bg.jpg')) How do I add the blurred effect to that background image? I tried with: (in viewDidLoad) let blurEffect = UIBlurEffec...
Mario Burga
1

votes
0

answer
20

Views

Pinning the bottom cell of a tableview on rotation

Just like in Telegram or Whatsapp, when the device rotates, the bottom cell should stay anchored to the bottom of the screen. However, when I rotate my device, the top cell is being anchored and stays foot. Couldn't find any solution online. Here is how I want a rotation to look like:
Nimrod Shai
1

votes
1

answer
70

Views

Swift UITableViewCell reusing is messing up tags / app has wrong calculation

I am making unit converter app with custom cells, every cell has a textbox inside and the idea was when u enter the value in one unit all units get calculated automatically, the problem is only when there are more cells and when u need to scroll when cells get reused they mess up tags and because my...
Dusan Dimic
1

votes
0

answer
235

Views

After adding and updating sticky with stretchy header in tableView, its scroll becomes jerky

I am developing a custom tableView with stretchy headerView and it also has sticky headerView. I have successfully achieved it by updating its contentInset and contentOffset properties. But after updating its contentInset the scroll becomes jerky. Below is the code for the same: I have added below c...
Akruti
1

votes
1

answer
47

Views

Why UITableView calculate its contentSize based on its default rowheight(44) not custom rowHeight

here is the question: if you have 20 cells and set tableView.rowHeight = 60, and after tableView load its data , its contentSize is 44*20=880 not 20*60=1200 what should i do if i want the contentSize is 1200
LE24
1

votes
1

answer
87

Views

Change UISlider controller when Table row clicked

I want to create a UISlider that when a user selects a tableview row. It updates the min & max value moves the slider to a value set by a variable. The slider is in a different Viewcontroller then the tableview. I am passing the values to the slider using a struct (Posted below). At this point, I ca...
k.thomas
1

votes
3

answer
65

Views

Why got I this error on my UISwipeGestureRecognizer?

I got this error on my UISwipeGestureRecognizer in my custom class cell manager It's working in my main UITableViewController class... I create a new instance in my ViewDidLoad with : let updateClass = updateCell() updateClass.swiper() I'm not pretty sure but on this thread, I should may be use lazy...
Danyl
1

votes
1

answer
551

Views

UITableView - footer for section - iPhoneX

I have problem with iPhone and UITableView section footer. It is being 'hidden' behind the top cut-out section. I have this code: override func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? { var content = 'some long text' let footerView = UIView(frame: CGRect(x...
Martin Perry
1

votes
1

answer
511

Views

Section Header of UITableview not pin at the top when scroll up - Swift

Normally, When I create table with style grouped, there are no any problem with section header. when I scroll up, the section header always stay at the top even when scroll pass it. I create one sample tableview using group style, section header not stay at the top when I scroll up like before. mayb...
Leang Socheat
1

votes
0

answer
30

Views

Core Data: split into sections based on custom logic

I have a large data set of objects, made up of 2 large-ish subsets. Set 1 has about 10,000 objects in it. Set 2 has about 70,000 objects in it. The object sets have many-to-many relationships between them. There are also 'favorites' subsets for both sets. Before I display set 1 or set 2, I will have...
mbm29414
1

votes
0

answer
36

Views

Checking Against Value From Array and Return Cell

I've 2 arrays A and B. Take for instance Array A has a field A1, and Array B has 2 fields B1 and B2. Both arrays contain the same variable - A1, B1 I'm trying to check the value of Array B (B1) against the Section Header Text of a TableView Since indexPath.section and indexPath.Row are used in Tabl...
ybba
1

votes
0

answer
54

Views

Sharing code between UITableViewCell & UITableViewHeaderFooterView subclasses

Currently, I've a UITableViewCell subclass that has the same view as UITableViewHeaderFooterView subclass. I setup the subclass views programmatically that includes a bunch of UILabels and UIImageviews. Currently, I've just copy/pasted the code between the two files. I was wondering if there is a wa...
JGlee
1

votes
1

answer
33

Views

UIImageView is displaying not correct

I've placed UIImageView in my custom cell (Swift 3): let cell = self.tableView.dequeueReusableCell(withIdentifier: 'Feedcell', for: indexPath) as! FruitTableViewCell let hero: List_Feed hero = heroes[indexPath.row] if(hero.photo==''){ cell.cnHeight.constant = 0 cell.cnTopMargin.constant = 0 cell.cnB...
Lexa Navalny
1

votes
0

answer
46

Views

Transferring Data from CollectionView inside TableView to a New ViewController

So I have a main ViewController that has Horizontal Scrolling CollectionViews inside a TableView. When you click on an Item in the CollectionView it transfers all the data from the Item to a new ViewController to display it properly. The problem I am facing is when you click on the item in the Coll...
Aman Chawla
1

votes
1

answer
129

Views

UIButton title inside UITableViewCell changes on reuse

I have a table view which has a data that consists of both phone contacts and facebook friends. the cell's button title should be 'Invite' if the user is a contact and 'Add' if it is a facebook friend. However, the titles on each button are wrong and are swapping on scroll. here is my model: struc...
rendell
1

votes
0

answer
146

Views

fade out first row in tableView when insert a new row

I tried this code to fade out the first cell in tableView but that code work when scrolling the table only I need it work like Instagram live streaming chat streamController.swift func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) - > UITableViewCell { var cell = tableView....
1

votes
1

answer
136

Views

Swift 3 tableview.reloadData on main thread, not displaying cells properly

In a simple TableViewController i am calling ClouKit deleteRecord in a UIAlertController. // 2. When the user clicks OK. alert.addAction(UIAlertAction(title: 'OK', style: .default, handler: { [weak alert] (_) in LSCloudKit.shared.deleteRecord(record: login.toCKRecord(), completion: { (success) in le...
Pascal Duff

View additional questions