uitableview

tableView.setContentOffset(_, animated:) do not work after beginUpdates()

二次信任 提交于 2021-02-10 18:28:41
问题 After using beginUpdates() endUpdates() This method -> tableView.setContentOffset(_, animated:) // do not work Do not work after calling that 2 methods (even if I use timer), but works without them! Any ideas why? setContentOffset works only if I swipe tableView manually after beginUpdates() + endUpdates() and BEFORE setContentOffset is being called. scrollToRowAtIndexPath works fine though but I need only setContentOffset . 回答1: tableView.setContentOffset(_, animated:) works now when I

How to add two UIButtons in Tableview section header

好久不见. 提交于 2021-02-10 17:30:38
问题 I added custom tableview header with two buttons, but buttons are disabled , unable to make control events. i want to get layout like this. i'm new to development. any suggestions or solution i tried to add view with buttons inside view in ViewforHeaderSection function func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { let inviteSectionHeaderview = UIView.init(frame: CGRect(x:0, y:0, width: self.view.bounds.width, height: self.view.bounds.height)) let

RefreshControl bugs first Cell of TableView, after using Back on NavBar

这一生的挚爱 提交于 2021-02-10 12:58:22
问题 I have a TableView embedded in NavigationController (and that's embedded in a TabBar Controller). I have a username button in each cell that segues to the user's profile. However after I hit 'back' on the profile page's nav bar, and gets directed back to tableview, it seems like I bugged something. And if I pull down again, it refreshs but this time, top row's username becomes unclickable while other rows work as expected. Please note that I call self.theRefreshControl = UIRefreshControl() in

RefreshControl bugs first Cell of TableView, after using Back on NavBar

若如初见. 提交于 2021-02-10 12:57:59
问题 I have a TableView embedded in NavigationController (and that's embedded in a TabBar Controller). I have a username button in each cell that segues to the user's profile. However after I hit 'back' on the profile page's nav bar, and gets directed back to tableview, it seems like I bugged something. And if I pull down again, it refreshs but this time, top row's username becomes unclickable while other rows work as expected. Please note that I call self.theRefreshControl = UIRefreshControl() in

Access each header and controls in the tableview in swift

妖精的绣舞 提交于 2021-02-10 08:43:32
问题 I have a UITableView with customized header. In that header I have a button with image. func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { let cView = UIView(frame: CGRectMake(0, 0, tableView.frame.size.width, 40)) itemNumBtn = UIButton(frame: CGRectMake(0, 0, 70, 42)) itemNumBtn.setBackgroundImage(UIImage(named: "hide.png"), forState: .Normal) cView.addSubview(itemNumBtn) return cView } I have five header secion. in separate function how can get the

Access each header and controls in the tableview in swift

允我心安 提交于 2021-02-10 08:43:14
问题 I have a UITableView with customized header. In that header I have a button with image. func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { let cView = UIView(frame: CGRectMake(0, 0, tableView.frame.size.width, 40)) itemNumBtn = UIButton(frame: CGRectMake(0, 0, 70, 42)) itemNumBtn.setBackgroundImage(UIImage(named: "hide.png"), forState: .Normal) cView.addSubview(itemNumBtn) return cView } I have five header secion. in separate function how can get the

PushViewController Twice When I double click too quickly

拜拜、爱过 提交于 2021-02-10 06:32:12
问题 I have the follow code when I call to push the ViewController to detailed chat controller ( 1-to-1 chat). However, if I click too quickly, the view controller will be pushed twice. I see the animation twice. Could anyone point me where the mistake is? The code is from a Youtube lesson (Firebase Chat) from LBTA. override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { let message = messages[indexPath.row] guard let chatPartnerId = message.chatPartnerId() else

Xcode Storyboard - Where to set UITableViewCell height

瘦欲@ 提交于 2021-02-10 05:48:05
问题 I am using Xcode 7 and I am trying to set the height of a UITableViewCell in the storyboard settings to have a different cell height for different devices (eg. normal and compact x regular). I cannot find a place for these settings. Is this only possible by doing it programmatically? 回答1: Click on Table View after that click on Size Inspector and adjust your cell row height here - Add this below code in your controller class viewDidLoad tableView.estimatedRowHeight = 100.0 // Adjust Primary

Keyboard events called before UITextView delegate events

。_饼干妹妹 提交于 2021-02-10 05:30:52
问题 I have a UITableView with UITextViews and UITextFields on it's cells. As obvious the keyboard overlaps the lower cells and you cannot see what you are typing. So I want to scroll the tableview to get the field visible. I wrote the code the iOS docs recommended: https://developer.apple.com/library/ios/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html BUT the keyboard event callback keyboardWillShow: is called before the UITextView edit

UITableView in UIView in UIScrollView. When scrolling tableview don't scroll scrollview too

99封情书 提交于 2021-02-09 08:49:07
问题 I have a UITableView inside a UIView inside a UIScrollView. Problem: when i scroll/drag the tableview, the scrollview scrolls too. What i need is for the tableview not to pass the scroll to the scrollview. Also i need to be able to use the scrollview when i scroll it directly. How can i do this? Cheers 回答1: I fixed it using "hitTest" on the tableview. - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event If the event originated within the tableview, i disable the parent's scrollview