Prop App Studios Prop App Studios - 11 days ago 7
Objective-C Question

No touch event on resized UIView

My problem is after increasing the height of UIView from 40pt (height mentioned in storyboard) to size around (1400) after updating data inside its UITableView child. The view is not getting events in increased area. It only receives touch event below original height.

View Heirarchy in xib file

- UIView(1)
-- UIView (1.1)
-- UIView (1.2) (commentView) (width superview.width, height - 40)
---UITableView (1.2.1) (commentTableView) (not in xib)

My code is -

override func viewDidLoad() {

commentView = view.viewWithTag(999)
// adding tableview inside comment view
if commentView != nil {
commentTableView = UITableView(frame: CGRectMake(0, 0, commentView.frame.width, commentView.frame.height))

// After adding rows to table, update size of table

func afterSettingTableContent() {"bound before change\(commentView?.bounds)")
commentView?.frame.size.height = (commentTableView?.contentSize.height)!

commentTableView.frame.size.height = (commentView?.frame.height)!
scrollView.contentSize.height += (commentView?.frame.size.height)!


The problem is height of superview of commentView i.e UIView(1) is fixed. Since clipToBounds is false child views are rendering fine and they are not receiving any touch because their size is still 40. After increasing height of view 1 everything is working fine.(Silly Mistake)