小编Vas*_*uta的帖子

如何每x次自动调用功能

可能重复:
如何在每个"X"分钟内调用函数?

如何定期调用某个功能?

- (void)viewDidLoad
{ 
    [super viewDidLoad];
    [self checkAlert];   
}



-(void)checkAlert{
    // Server output Alert Note
    NSString *alert_note_hostStr = @"http://www.loxleyintranet.com/MobileApplication/xml/alert_note.php";
    NSData *alert_note_dataURL = [NSData dataWithContentsOfURL:[NSURL URLWithString:alert_note_hostStr]];
    NSString *alert_note_serverOutput = [[NSString alloc] initWithData:alert_note_dataURL encoding:NSASCIIStringEncoding];

    if ([alert_note_serverOutput isEqualToString:@"0"]) {
        alertImage.hidden = YES;
        alertLabel.hidden = YES;
        underMainBG.hidden = YES;
        alertLabel.text = [NSString stringWithFormat:@"No Alert"];
    }else{    
        alertLabel.text = [NSString stringWithFormat:@"You've Got Note (%@)" ,alert_note_serverOutput];

    }    
}
Run Code Online (Sandbox Code Playgroud)

我怎样才能[self checkAlert];每隔x几分钟或几秒钟打电话?

xcode uilabel nsdata ios

11
推荐指数
2
解决办法
1万
查看次数

标签 统计

ios ×1

nsdata ×1

uilabel ×1

xcode ×1