0

Hi so this might seem like a very trivial question to most people but its really caught me off guard. I'm using storyboards to create my app and when a user signups for the first time they are taken through an "intro". I have a UIProgressView to show the user how far through they are and it's set in each view controller. However I need to get the value that the progress view is set to in my code and I keep getting incompatible type errors.

//viewcontroller.m
float complete = _progress;


//viewcontroller.h
 @property (weak, nonatomic) IBOutlet UIProgressView *progress;

I've tried multiple other lines of codes, however this brings me the one with the least errors ! Help would be very much appreciated!

cjbatin
  • 283
  • 2
  • 16

1 Answers1

2

Use

float complete = self.progress.progress;

or

float complete = _progress.progress;

instead of

float complete = _progress;

Use good naming convention it will help to avoid errors and improve readability of code.you can declare it as progressView for more clarity

@property (weak, nonatomic) IBOutlet UIProgressView *progressView;

and access it as

float complete = self.progressView.progress;
codester
  • 36,891
  • 10
  • 74
  • 72
  • Thank you so much! Relatively new to Object-C so this helps clarify how it works a lot as well thanks! I would vote up the clarity of your answer as well if I had the reputation to be able to! – cjbatin Jul 20 '14 at 11:04