//class 1
int sliderMaximum;
float sliderMaximumDigital;
-(void)viewDidLoad
{
[super viewDidLoad];
class 2 *V1 = [[class 2 alloc] init];
sliderMaximum = V1.TeamAmountAfterSave;
NSNumber *yourNumber = [NSNumber numberWithInt:sliderMaximum];
sliderMaximumDigital = [yourNumber floatValue];
[sliderTeamSelect setMaximumValue:sliderMaximumDigital];
}
//class 2
int teamAmount;
@synthesize TeamAmountAfterSave; (In .h file (@property int TeamAmountAfterSave;))
TeamAmountAfterSave = teamAmount;
// This code almost works correctly the only problem is my sliders Maximum Value is set to 0.
// ps. teamAmount has the value of how many times a button has been pressed.
You’re allocating a new view controller (
[[CompetitionViewController alloc] init]) and then you’re immediately querying one of its properties (sliderMaximum = V1.TeamAmountAfterSave). So unless theinitofCompetitionViewControllerdoesn’t explicitly set the value read by the propertyTeamAmountAfterSave, it will of course be 0.I’ve got no idea what you’re trying to accomplish, but it sounds like you want a manager object (possibly a singleton) that stores/manages your data. A view controller is not the place to do it.