Oct 22, 2017 Replies: 2 Just a quick question about inline Objective-C: Can I declare a variable outside of a method? This seems like a really basic question but I haven't use inline objective-c before and wanted to be sure before proceeding. Example: Code: Copy UIStackView *stackView =[[UIStackView alloc] init]; //This is outside the scope of methods. - (void) myMehtod{ } Last edited: Oct 22, 2017 Click to expand...
Just a quick question about inline Objective-C: Can I declare a variable outside of a method? This seems like a really basic question but I haven't use inline objective-c before and wanted to be sure before proceeding. Example: Code: Copy UIStackView *stackView =[[UIStackView alloc] init]; //This is outside the scope of methods. - (void) myMehtod{ }
Erel B4X founder Staff member Licensed User Longtime User Oct 23, 2017 #2 No. However you don't need to use inline C to create this object: Code: Copy Dim stackView As NativeObject stackView = stackView.Initialize("UIStackView").RunMethod("alloc", Null).RunMethod("init", Null)
No. However you don't need to use inline C to create this object: Code: Copy Dim stackView As NativeObject stackView = stackView.Initialize("UIStackView").RunMethod("alloc", Null).RunMethod("init", Null)
LWGShane Well-Known Member Licensed User Longtime User Oct 23, 2017 #3 Erel said: No. However you don't need to use inline C to create this object: Code: Copy Dim stackView As NativeObject stackView = stackView.Initialize("UIStackView").RunMethod("alloc", Null).RunMethod("init", Null) Click to expand... I've got it working... However, it's not aligned properly and it randomly (?) tells me that the Orientation property is nil which it really isn't. I might do a test and create the StackView via NativeObject and just have Objective-C handle the rest. Attachments AGStackView.zip AGStackView.zip 3.9 KB · Views: 680 Last edited: Oct 24, 2017
Erel said: No. However you don't need to use inline C to create this object: Code: Copy Dim stackView As NativeObject stackView = stackView.Initialize("UIStackView").RunMethod("alloc", Null).RunMethod("init", Null) Click to expand... I've got it working... However, it's not aligned properly and it randomly (?) tells me that the Orientation property is nil which it really isn't. I might do a test and create the StackView via NativeObject and just have Objective-C handle the rest.