loadview

overriding loadView in a UITableViewController subclass

老子叫甜甜 提交于 2019-12-07 03:12:52
问题 I am trying to setup a UITableViewController so that its tableView belongs to my custom subclass. My loadView method currently looks like this: - (void) loadView { MyTableViewSubclass* tv = [[[MyTableViewSubclass alloc]initWithFrame: CGRectZero style: UITableViewStylePlain]autorelease]; self.view = tv; self.tableView = tv; } I am getting crashes later on that go away if I comment out the above method. So something is missing. But what? Apple's documentation says I should not be calling super

What are the side effects of calling [super loadView]

此生再无相见时 提交于 2019-12-05 13:05:49
In the docs for loadView , Apple states: Your custom implementation of this method should not call super. So I tried calling [super loadView] in my loadView method. Nothing bad seemed to happen and there was no warning. I'm using a view created programatically, in loadView , not from a NIB. What (if any) bad things actually happen when I call [super loadView] ? Calling [super loadView] will cause the UIViewController implementation of loadView to run. Among other things, this is the method that loads a view from a NIB, if a nibName has been provided. So if you were to call super last, it might

overriding loadView in a UITableViewController subclass

那年仲夏 提交于 2019-12-05 06:28:18
I am trying to setup a UITableViewController so that its tableView belongs to my custom subclass. My loadView method currently looks like this: - (void) loadView { MyTableViewSubclass* tv = [[[MyTableViewSubclass alloc]initWithFrame: CGRectZero style: UITableViewStylePlain]autorelease]; self.view = tv; self.tableView = tv; } I am getting crashes later on that go away if I comment out the above method. So something is missing. But what? Apple's documentation says I should not be calling super in loadView. Which makes sense, because I want the view to have my class, not theirs. Things I've tried

Is it ok to call [super loadView]?

让人想犯罪 __ 提交于 2019-12-04 09:57:36
问题 I thought that I should never call [super loadView] but something is confusing me. In description of loadView (UIViewController Class Reference) it is said that "Your custom implementation of this method should not call super.", but in ZoomingPDFViewer example that they gave, loadView implementation (ZoomingPDFViewerViewController) is calling [super loadView]. I have tried to call it from my loadView method and it works ok, but I just don't understand then what does it mean to not call super.

The frame size of the view is not changing on rotation when the view is created with loadView

女生的网名这么多〃 提交于 2019-12-03 20:14:48
I have UIViewController without a xib, and I'm using loadView to build my UI that creates and adds two scroll views. The thing is, the main view frame size is not changing when rotation happens. I mean, I'm setting initial frame size for the main view in loadView (portrait mode: frame size width = 320, height = 480). After rotation to landscape orientation, the view main frame size isn't changing and is the same as in portrait mode. Here's my loadView: -(void)loadView{ CGRect screenBounds = [[UIScreen mainScreen] bounds]; self.view = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, screenBounds

Is it ok to call [super loadView]?

左心房为你撑大大i 提交于 2019-12-03 05:29:17
I thought that I should never call [super loadView] but something is confusing me. In description of loadView ( UIViewController Class Reference ) it is said that "Your custom implementation of this method should not call super.", but in ZoomingPDFViewer example that they gave, loadView implementation ( ZoomingPDFViewerViewController ) is calling [super loadView]. I have tried to call it from my loadView method and it works ok, but I just don't understand then what does it mean to not call super. You definitely should not be calling [super loadView] . I'd say you found a bug in the

loadView: functions in UIView iOS

大城市里の小女人 提交于 2019-11-30 13:28:16
I don't understand the mechanism of loadView: function (this function is in UIView). I created a project as below: First, I created a iPhone's window-based project. Then, I created a UIView subclass Next, I created a UIViewController subclass, with no xib. Lastly, in the loadView: function of the class I created in the third step, I designate the UIView object (in the class I created in the second step) as the view variable of the UIViewController object (in the third step). If I omit the last step, and place the statement NSLog(@"test LoadView"); in the loadView: function, then when the

loadView: functions in UIView iOS

纵饮孤独 提交于 2019-11-29 19:15:19
问题 I don't understand the mechanism of loadView: function (this function is in UIView). I created a project as below: First, I created a iPhone's window-based project. Then, I created a UIView subclass Next, I created a UIViewController subclass, with no xib. Lastly, in the loadView: function of the class I created in the third step, I designate the UIView object (in the class I created in the second step) as the view variable of the UIViewController object (in the third step). If I omit the

Force viewDidLoad to fire on iOS

梦想的初衷 提交于 2019-11-28 21:15:52
I have two window app and while I present first window I would like the view in second window to load and prepare content for later in background. I've tried to use method loadView but Apple says you should not call this method directly. So far I've chosen to use the view's method userInteractionEnabled which actually implicitly calls viewDidLoad method. Is there an elegant way to force ViewControllers viewDidLoad method to fire before it should naturally (when window is key and presented)? You can just call [viewController view]; . The documentation for UIViewController explains how the view