i need to do like this:
-(void)function1{
goto start;
}
-(void)function2{
//some code
start://i need to get in here exactly, [self function2] oblige me to execute the function2 from the beginning
//some code..
}
Seems i can not, what can i do instead? thanx in advance.
EDIT: here is my actual code:
-(void)viewWillAppear:(BOOL)animated{
if (sqlite3_open(dbpath, &contactDB) == SQLITE_OK)
{
NSString *querySQL = [NSString stringWithFormat:
@"Select quiz,question,p1,p2,p3,num_correct from question where quiz=(select id from quiz where nom = \'%@\' and niveau= \'%i\' and theme=(select id from theme where nom=\'%@\'))",nomPartieQuiz,quiIslam.theGameLevel,quiIslam.themeChoisie];
const char *query_stmt = [querySQL UTF8String];
if (sqlite3_prepare_v2(contactDB,
query_stmt, -1, &statement, NULL) == SQLITE_OK)
{
start://étiquette
while (sqlite3_step(statement) == SQLITE_ROW && !passToNextQuestion)
{
NSString *addressField = [[NSString alloc]
initWithUTF8String:
(const char *) sqlite3_column_text(
statement, 1)];
NSLog(@"%@",addressField);
txtView.text=addressField;
passToNextQuestion=NO;
}
sqlite3_finalize(statement);
}
sqlite3_close(contactDB);
}
}
-(IBAction)clickOnTheButton:(id)sender{
btn1.hidden=YES;
goto start;
}
Try this:
And, using “gotos” its only allowed in a very very very specifically kind of situations, you should forget about them right now! It goes again any developing principle.