Illep
Illep

Reputation: 16841

How to call a UIView from a UIViewController

I need to create a transparent UIView with an UIActivityIndicator and an UIImage on it. I found a code from a tutorial as in how to create the Round edge UIView.

  1. Can someone help me call this UIView from my UIViewController class. (To call a UIViewConroller from another UIViewController we use the following code;)

    ViewOne *v1 = [ViewOne alloc] initWithNibName:nil bundle:nil]; [self.navigationController v1 animated:YES];

but this doesn't work when calling UIView's. So how can i call it ?

  1. To add an UIImage and a UIActivity indicator programatically to the UIView ?

Upvotes: 0

Views: 1504

Answers (2)

Jakob W
Jakob W

Reputation: 3377

Every view controller has a view property. Just use UIView *yourView = yourViewController.view to get it. From there you can use [yourView addSubView:someOtherView] to add the activity indicator and the image, as well as setting the transparency.

Upvotes: 1

Joel Martinez
Joel Martinez

Reputation: 47751

wouldn't you just wire up the UIView to an IBOutlet, and then just add your programmatically created view to the outlet

Upvotes: 0

Related Questions