I am Using StoryBoard and Using Autolayout , I have set Constraints at runtime for Custom cell.Also I have set constraints in ViewDidLayoutSubviews to Handle Device Orientation. So This is taking time for Cell to configure and my cell is not Scrolling Smoothly .Can anyone help me on this?If I have to not set constraints at runtime then where should I set them?Hope I am Clear.Thanks in advance
iOS:TableView Not Scrolling Smoothly due to Setting Constraints at Runtime in CellForRowAtIndexPath
309 views Asked by Asmi237 At
2
There are 2 answers
2
sgl0v
On
I would suggest you to define a UITableViewCell's subclass and create all constraints in the init/initWithCoder: method.
And don't forget to reuse your cells correctly. In this way you won't re-create your cell's constraints all the time.
EDIT: take a look at the example below.
static NSString* const kCellIdentifier = @"CustomTableViewCellIdentifier";
@implementation CustomTableViewController
- (void)viewDidLoad
{
[self.tableView registerClass:[CustomTableViewCell class] forCellReuseIdentifier:kCellIdentifier];
}
- (UITableViewCell*) tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath
{
CustomTableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:kCellIdentifier];
// configure your cell here
return cell;
}
@end
@interface CustomTableViewCell: UITableViewCell
@end
@implementation CustomTableViewCell
- (instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)reuseIdentifier
{
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
{
// add subviews and install constraints here. Don't forget to use contentView instead of cell when you install constraints.
}
return self;
}
@end
Related Questions in IOS
- URLSession requesting JSON array from server not working
- Incorrect display of LinearGradientBrush in IOS
- Module not found when building flutter app for IOS
- How to share metadata of an audio url file to a WhatsApp conversation with friends
- Occasional crash at NSURLSessionDataTask dataTaskWithRequest:completionHandler:
- Expo Deep linking on iOS is not working (because of Google sign-in?)
- On iOS, the keyboard does not offer a 6-character SMS code
- Hi, there is an error happened when I build my flutter app, after I'm installing firebase packages occurs that error
- The copy/paste functionalities don't work only on iOS in the Flutter app
- Hide LiveActivityIntent Button from Shortcuts App
- While Running Github Actions Pipeline: No Signing Certificate "iOS Development" found: No "iOS Development" signing certificate matching team ID
- Actionable notification api call not working in background
- Accessibility : Full keyboard access with scroll view in swiftui
- There is a problem with the request entity - You are not allowed to create 'iOS' profile with App ID 'XXXX'
- I am getting "binding has not yet been initialized" error when trying to connect firebase with flutter
Related Questions in OBJECTIVE-C
- How to control the volume of an iPhone programmatically in objective-c
- Occasional crash at NSURLSessionDataTask dataTaskWithRequest:completionHandler:
- How to set value the descriptor of iOS BLE in Objective-C?
- Unexpected #selector() Behavior in Swift-Objective-C Interop?
- In what context can we use an unqualified #selector() expression in Swift?
- AVPictureInPictureController crashes during initialization
- How to use pow() in Objective-C?
- How to change the image on the MGSwipeButton in MGSwipeTableCell
- Using sort descriptors in Outline View
- Why is my Swift function not printing from inside the dataTask closure?
- Using UICollectionViewCell with IBOutlet
- Undefined symbol: _OBJC_CLASS_$_ only on simulator
- Why can't I receive a notification sent from Camera Extension(Swift) to an observer application (obj-c++)
- Behavior of __block modifier in objc
- Inserting subview into view where I've added subviews and sublayers
Related Questions in UITABLEVIEW
- How to make tableview reload correct data?
- UITableView hierarchy is not in a single line
- How to delete the space between UITableViewCell in plain style UITableView on visionOS?
- Dropping Pin into Map view when table view cell is selected
- UITableView not showing class array data
- Inconsistent Index Path Printing in UITableView Cell with UIButton Inside
- Potential race condition on Combine's @Published property wrapper
- UITableView gets cut off at the bottom / UIScrollView, UITableView, uitableviewdiffabledatasource
- Cannot Convert Custom ExpyTableView Type in Swift
- How to create the following design using Swift UIKit?
- UITextView textContainer.exclusionPaths not working well
- The content of UIHostingController has a weird offset when it is placed in each uitableviewcell
- UITableView's cellForRowAt not being called
- How do I inject reference types in a table view cell and reload the row of the said cell without causing a memory leak?
- Animation in UICollectionViewCell Stops When Reloading Array Data
Related Questions in IOS-AUTOLAYOUT
- Autolayout Buttons not correct
- How to setup constraints to invade another view
- Weird transition of UILabel in modal during device orientation change
- Autlolayout not updating frames by the time call to systemLayoutSizeFitting(:withHorizontalFittingPriority:verticalFittingPriority:) is made
- UIStackView arrangedElement override alignment
- How to add new constraint in XCode 11.5
- Change width constraint of a Button in StackView Programmatically
- Have autolayout CHANGE the height of a cell, already on screen, in a dynamic height cell table?
- What is the white area around the UILabel when it is selected in storyboard?
- UITableViewCell auto layout constraint problems due to separator line height
- Constraints issue
- UITextView and other elements inside UIScrollView with AutoLayout
- How to make a Self-sizing UiImageView?
- Width of UITableView Cell not changed when constraints are applied xcode storyboard
- how to fit collection view cell in table view cell ( adaptive on all screen sizes?)
Related Questions in VIEWDIDLAYOUTSUBVIEWS
- The difference between viewDidLayoutSubviews and NSLayoutConstraint
- StackView returns the ex-height in viewDidLayoutSubviews
- viewDidLayoutSubviews & UIApplicationDidBecomeActive notification
- De activate constraints between 2 objects linking them together
- Why viewDidLayoutSubviews and viewWillLayoutSubviews is not getting called in view controller
- iOS 13 - viewDidLayoutSubviews called on changing frame
- iOS get the subviews bounds when rotation happened
- moving app to background, calls viewDidLayoutSubView and create a lot of warnings with UICollectionView
- viewDidLayoutSubviews getting called twice and convertPoint improperly converting on first render
- How to set content width to the size of device/parent width?
- Why doesn't code in (isMovingToParentViewController) run in viewDidLayoutSubviews()
- Swift 4: didSet @IBOutlet calls viewDidLayoutSubviews, but not with addSubview()
- Auto resizing corner radius using viewDidLayoutSubviews() not updating the view before it is displayed
- Why the Horizontal line in text fields are conflicting in Landscape mode in ipad in Swift?
- I want to change bottom layer of text field color when i start typing to blue
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
I'm with nburk, it is not possible to solve with this short detail. But as You are using custom cell in tableView. In the cellForRowAtIndexPath method every time the cell is created so you can use dispatch_async(dispatch_get_main_queue(), ^{......your code here for custom cell..... }); //used for updating UI I'm not sure but as your lines it showing the screen UI is not updating on time.