BUYProductViewController Class Reference

Inherits from BUYViewController : UIViewController
Conforms to BUYThemeable
Declared in BUYProductViewController.h

– initWithClient:theme:

Creates a BUYProductViewController with a BUYClient and a theme Note: Use this initializer to instatiate a BUYProdctViewController with a custom theme. If you don’t need to customize the theme use initWithClient:

- (instancetype)initWithClient:(BUYClient *)client theme:(BUYTheme *)theme

Parameters

client

A BUYClient configured to your shop

theme

A BUYTheme

Return Value

A BUYViewController

Declared In

BUYProductViewController.h

– loadProduct:completion:

Loads the product details

- (void)loadProduct:(NSString *)productId completion:(void ( ^ ) ( BOOL success , NSError *error ))completion

Parameters

productId

the product ID for the item to display

completion

a block to be called on completion of the loading of the product details. Will be called on the main thread. Upon success, the view controller should be presented modally

Declared In

BUYProductViewController.h

– loadWithProduct:completion:

Alternative method when setting the product (and optionally, shop) directly on the view controller

- (void)loadWithProduct:(BUYProduct *)product completion:(void ( ^ ) ( BOOL success , NSError *error ))completion

Parameters

product

the product to display

completion

block called when view controller is ready for display. Called on main thread

Declared In

BUYProductViewController.h

  productId

The loaded product ID

@property (nonatomic, strong, readonly) NSString *productId

Declared In

BUYProductViewController.h

  product

The product to be displayed. This can be set before presentation instead of calling loadProduct:completion:

@property (nonatomic, strong, readonly) BUYProduct *product

Declared In

BUYProductViewController.h

  isLoading

Returns YES when the view controller is loading data. loadProduct: or loadWithProduct: should not be called when data is already loading

@property (nonatomic, assign, readonly) BOOL isLoading

Declared In

BUYProductViewController.h

– presentPortraitInViewController:

This is a convenience method as an alternative to presentViewController: which will force portrait orientation. This method is only required when presenting from a landscape view controller.

- (void)presentPortraitInViewController:(UIViewController *)controller

Parameters

controller

The view controller where the BUYProductViewController is to be presented on

Declared In

BUYProductViewController.h