我需要做這樣的標籤:轉到到另一個函數
-(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..
}
看來我不能,我能做些什麼呢? thanx提前。
編輯:這裏是我的實際代碼:
-(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;
}
你能發佈你的實際代碼,所以我們可以看到使用goto背後的推理嗎? – 2012-03-13 13:59:36
編輯,請看看:) – Luca 2012-03-13 14:02:50