user3763526
user3763526

Reputation: 65

IBOutlet property of the type

I'm trying to install a pre-made custom progress bar in my app and according to the tutorial from the website i got the code from, i need to:

"On the view controller's header file create an IBOutlet property of the type MCPercentageDoughnutView and link it to the object you created on the Interface Builder."

Can someone explain me how do I create an IBOutlet property of the type MCPercentageDoughnutView? I tried doing:

__weak IBOutlet MCPercentageDoughnutView *pieChart;

It gives me the error: Unknown type name 'MCPercentageDoughnutView'. What am i doing wrong?

Upvotes: 0

Views: 70

Answers (2)

mithlesh jha
mithlesh jha

Reputation: 343

If the IBOutlet is to be declared in header file, you can do a forward declaration of MCPercentageDoughnutView in the header file and import the class MCPercentageDoughnutView.h file in your implementation file.

@class MCPercentageDoughnutView // In your header file

#import "MCPercentageDoughnutView.h" // In your implementation file

However, if the IBOutlet is to be declared in the implementation file (in your class' extension), the forward declaration in header file is not required.

Upvotes: 0

gvuksic
gvuksic

Reputation: 3013

In header file you should also:

#import "MCPercentageDoughnutView.h"

Upvotes: 1

Related Questions