I’m making my own web browser for the iPad, and I have a problem while I’m trying to make the history. Here’s the code:
.m
-(void)viewDidLoad{
[self historyMethod];
//more settings...
}
-(void)historyMethod{
NSString *googleString= @"http://www.google.es";
NSString *currentURLString=TextField.text;
[historyArray addObject:googleString];
if ([googleString isEqual: currentURLString]) {
googleString = nil;
[TableView reloadData];
}
[historyArray addObject: currentURLString ];
[TableView reloadData];
}
The problem that I have is that the historyMethod is executed just one time, and I need it working all the time! Since I’m a newbie, I don’t know too much about methods, and how I can make it work well. I tried it with a while loop but it didn’t work. Please help me people!
You mean you want the method to be called repeatedly?
you can use something like
NSTimerto repeat a method call;This will call your method every 1 seconds, place this in your
viewDidLoadmethod, instead of calling yourhistoryMethod.However, if you don’t understand methods, I’d recommend some looking for some Objective-C tutorials.