Setting the frame of an UIView does not work

前端 未结 4 1809
说谎
说谎 2020-12-28 16:16

I have a problem with the frame-property in iOS 7. I wanna resize some UIViews in the viewDidLoad-method of my UIViewController, but if I do it lik

4条回答
  •  心在旅途
    2020-12-28 16:44

    There are several reasons why this might be happening. First of all, you need to make sure that your tableview isn't nil. If you're creating it programmatically, you need to be sure that you're calling alloc/init somewhere before you attempt to set the frame. If self.leftSideTableView is an IBOutlet, this can be caused by forgetting to actually link the outlet to the interface object.

    Then, second and less likely, you are creating the table view programmatically and initializing it properly, but you forgot to add it as a subview of one of your on screen views.

提交回复
热议问题