重複の可能性:
iOS6 UIAlertView.titleが壊れていますか?
// btnstartgame.enabled = yesですが、有効にしないでください。理由がわかりません。助けてください。
//PS。このコードは、保存された文字列を2つのラベルに与え、それらが同じであるかどうかを確認する必要がありますが、何らかの理由で同じになることはありません。(それら= lblTeamOneおよびlblTeamTwo)
@synthesize lblTeamOne;
@synthesize lblTeamTwo;
@synthesize sliderTeamOneOutlet;
@synthesize sliderTeamTwoOutlet;
@synthesize btnStartGame;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self)
{
// Custom initialization
}
return self;
}
-(void)loadTeams:(NSString*)location:(UILabel*)lblname
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *loadstring = [defaults objectForKey:location];
lblname.text = loadstring;
}
-(void)sliderdisplay:(UISlider *)sliderOutlet :(UILabel *)lblName
{
if(0 < sliderOutlet.value && 1 >= sliderOutlet.value)
{
[self loadTeams:@"save1" :lblName];
}
if(1 < sliderOutlet.value && 2 >= sliderOutlet.value)
{
[self loadTeams:@"save2" :lblName];
}
if(2 < sliderOutlet.value && 3 >= sliderOutlet.value)
{
[self loadTeams:@"save3" :lblName];
}
if(3 < sliderOutlet.value && 4 >= sliderOutlet.value)
{
[self loadTeams:@"save4" :lblName];
}
if(4 < sliderOutlet.value && 5 >= sliderOutlet.value)
{
[self loadTeams:@"save5" :lblName];
}
if(5 < sliderOutlet.value && 6 >= sliderOutlet.value)
{
[self loadTeams:@"save6" :lblName];
}
if(6 < sliderOutlet.value && 7 >= sliderOutlet.value)
{
[self loadTeams:@"save7" :lblName];
}
if(7 < sliderOutlet.value && 8 >= sliderOutlet.value)
{
[self loadTeams:@"save8" :lblName];
}
}
-(void)loadMaximum
{
int teamAmount = [[[NSUserDefaults standardUserDefaults] objectForKey:@"teamAmount"] intValue];
NSNumber *yourNumber = [NSNumber numberWithInt:teamAmount];
float sliderMaximumDigital = [yourNumber floatValue];
[sliderTeamOneOutlet setMaximumValue:sliderMaximumDigital];
[sliderTeamTwoOutlet setMaximumValue:sliderMaximumDigital];
}
- (void)viewDidLoad
{
[super viewDidLoad];
[self loadMaximum];
[self loadTeams:@"save1" :lblTeamOne];
[self loadTeams:@"save1" :lblTeamTwo];
if(lblTeamOne == lblTeamTwo)
{
btnStartGame.enabled = NO;
}
if(lblTeamOne.text == lblTeamTwo.text)
{
btnStartGame.enabled = NO;
}
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
- (IBAction)sliderTeamOneAction:(id)sender
{
[self sliderdisplay:sliderTeamOneOutlet :lblTeamOne];
}
- (IBAction)sliderTeamTwoAction:(id)sender
{
[self sliderdisplay:sliderTeamTwoOutlet :lblTeamTwo];
}
// 前もって感謝します。