Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/extensions/Variables/includes/ExtVariables.php on line 198
OBWelcomeController: Difference between revisions - iPhone Development Wiki

OBWelcomeController: Difference between revisions

From iPhone Development Wiki
m (Grammar; additional info)
(Added link to example OBWelcomeController.)
 
(2 intermediate revisions by one other user not shown)
Line 9: Line 9:


- You can use any regular UIImage. The system image is used here as an example.
- You can use any regular UIImage. The system image is used here as an example.
- Outside of <tt>contentLayout</tt>, all arguments for initializing (and for adding an item - explained in the next section) can be nil. If an argument is nil, its corresponding view is not created, and OBWelcomeController adapts the spacing accordingly.


==Adding items to the controller==
==Adding items to the controller==
Line 14: Line 16:
[exampleWelcomeController addBulletedListItemWithTitle:@"Item 1" description:@"A nice-looking, responsive description." image:[UIImage systemImageNamed:@"app"];
[exampleWelcomeController addBulletedListItemWithTitle:@"Item 1" description:@"A nice-looking, responsive description." image:[UIImage systemImageNamed:@"app"];


[exampleWelcomeController addBulletedListItemWithTitle:@"Item 2" description:@"It can be as long as you want - the view will auto-resize, and even center the icon for the item!" image:[UIImage systemImageNamed:@"plus.app"];
[exampleWelcomeController addBulletedListItemWithTitle:@"Item 2" description:@"This can be as long as you want, as the view automatically sizes itself - even centering the icon for the item accordingly!" image:[UIImage systemImageNamed:@"plus.app"];


[exampleWelcomeController addBulletedListItemWithTitle:@"Item 3" description:@"Look at you, making fancy views. If only Apple would make this framework public." image:[UIImage systemImageNamed:@"app.badge"];
[exampleWelcomeController addBulletedListItemWithTitle:@"Item 3" description:@"Look at you, making fancy views. If only Apple would make this framework public." image:[UIImage systemImageNamed:@"app.badge"];
Line 32: Line 34:
[aViewController presentViewController:exampleWelcomeController animated:YES completion:nil];
[aViewController presentViewController:exampleWelcomeController animated:YES completion:nil];
</source>
</source>
==Example Controller==
For an in-depth example, [https://gist.github.com/chrisharper22/17541f484f05542b0ad78a1e334835da view this example] GitHub Gist by Simalary (Chris).
==External links==
https://gist.github.com/chrisharper22/17541f484f05542b0ad78a1e334835da


{{occlass|library=OnBoardingKit.framework|navbox=on}}
{{occlass|library=OnBoardingKit.framework|navbox=on}}

Latest revision as of 20:47, 13 July 2020

OBWelcomeController is a view controller subclass in OnBoardingKit.framework.

Creating an instance

OBWelcomeController *exampleWelcomeController = [[OBWelcomeController alloc] initWithTitle:@"Example Title" detailText:@"Example Details" icon:[UIImage systemImageNamed:@"circle" contentLayout:2];

A few notes

- contentLayout:2 seems to be the only way to go. Other options appear to crash.

- You can use any regular UIImage. The system image is used here as an example.

- Outside of contentLayout, all arguments for initializing (and for adding an item - explained in the next section) can be nil. If an argument is nil, its corresponding view is not created, and OBWelcomeController adapts the spacing accordingly.

Adding items to the controller

[exampleWelcomeController addBulletedListItemWithTitle:@"Item 1" description:@"A nice-looking, responsive description." image:[UIImage systemImageNamed:@"app"];

[exampleWelcomeController addBulletedListItemWithTitle:@"Item 2" description:@"This can be as long as you want, as the view automatically sizes itself - even centering the icon for the item accordingly!" image:[UIImage systemImageNamed:@"plus.app"];

[exampleWelcomeController addBulletedListItemWithTitle:@"Item 3" description:@"Look at you, making fancy views. If only Apple would make this framework public." image:[UIImage systemImageNamed:@"app.badge"];

Managing the button tray

Inlining the button tray

By default, the button tray has a blur effect behind it if the bulleted list goes past where the button tray would normally be. If you would rather have the button tray placed below the list, so that the user must scroll to see the button tray, just set:

exampleWelcomeController._shouldInlineButtonTray = YES;

This also removes the blur effect from the button tray.

Pushing the controller

[aViewController presentViewController:exampleWelcomeController animated:YES completion:nil];

Example Controller

For an in-depth example, view this example GitHub Gist by Simalary (Chris).

External links

https://gist.github.com/chrisharper22/17541f484f05542b0ad78a1e334835da