我正与转换控制合作,只要我从网页上航行或重新开始申请,其价值套就会违约。 怎么去做,这样,如果施加压力,它就应当中止,或者如果停止,就应该中止,直到我们手工改变为止?
Here is my code where I m allocating and setting ffram for scrollview
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell new";
listData =[self.tableContents objectForKey:[self.sortedgroups objectAtIndex:[indexPath section]]];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]autorelease];
}
NSUInteger row = [indexPath row];
cell.textLabel.text = [listData objectAtIndex:row];
if(indexPath.section==0)
{
switch (indexPath.row)
{
case 0:
{
switcher = [[[UISwitch alloc] initWithFrame:CGRectZero] autorelease];
[switcher addTarget:self action:@selector(switchAction:)
forControlEvents:UIControlEventValueChanged];
cell.accessoryView = switcher;
switcher.tag = indexPath.row;
//cell.textLabel.text=@"switcher";
}
break;
case 1:
{
slide = [[[UISlider alloc] initWithFrame:CGRectMake(0,0, 150, 15)] autorelease];
[slide addTarget:self action:@selector(slideact:)
forControlEvents:UIControlEventValueChanged];
cell.accessoryView = slide;
// slide.tag = indexPath.row;
}
break;
}
}
}
这是我转换行动的方法:
- (void)switchAction:(UISwitch*)sender
{
NSLog(@"switchAction: sender = %d, isOn %d", [sender tag], [sender isOn]);
if(sender.on)
{
[[NSUserDefaults standardUserDefaults]setObject:@"on" forKey:@"switcher"];
[[NSUserDefaults standardUserDefaults]synchronize];
}
else
{
[[NSUserDefaults standardUserDefaults]setObject:@"off" forKey:@"switcher"];
[[NSUserDefaults standardUserDefaults]synchronize];
}
}
-(void)viewWillAppear:(BOOL)animated
{
if ([[[NSUserDefaults standardUserDefaults]valueForKey:@"switcher"]isEqualToString:@"on"])
{
switcher.on=YES;
}
else
{
switcher.on=NO;
}
}