我想根據光標位置來隱藏導航欄,所以我可以使用iPhone的全屏。但我不知道如何開始它。如何根據光標位置隱藏導航欄來使用全屏?
類似(減少混亂:))問題:Show/hide UIToolbar, "match finger movement", precisely as in for example iOS7 Safari
我想根據光標位置來隱藏導航欄,所以我可以使用iPhone的全屏。但我不知道如何開始它。如何根據光標位置隱藏導航欄來使用全屏?
類似(減少混亂:))問題:Show/hide UIToolbar, "match finger movement", precisely as in for example iOS7 Safari
使用下面的代碼,如果你想隱藏和取消隱藏在雙擊導航欄上的視圖的任何部分
在您的.h文件中:
IBOutlet UINavigationController *navigationController;
將IBOutlet連接到您的XIB中。
在.m文件:
-(void)viewDidLoad {
[super viewDidLoad];
[navigationController setNavigationBarHidden:YES];
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ UITouch *touch = [touches anyObject];
if (touch.tapCount == 2) {
[navigationController setNavigationBarHidden:NO];
[NSTimer scheduledTimerWithTimeInterval:(1.0) target:self selector:@selector(hideBar) userInfo:nil repeats:NO];
}
}
-(void)hidebar{
[navigationController setNavigationBarHidden:YES];
}
做修改,按照您的要求。
快樂編碼!
thanks.i將工作。 – iphoneStruggler 2010-09-27 05:34:33
wlcome。獲得投票是最好的謝謝。 :P – 2010-09-27 08:30:29
iPhone上沒有光標,但是你的意思是你想做類似safari的操作 - 在向下滾動多個屏幕頁面時隱藏地址欄?
假設你正在使用的UITableView,我有一個解決方案: 1.我們已經知道每個錶行的高度 - > cell.frame.size.heigh 2,我們已經知道了屏幕的高度 - > view.bounds.size.height 3.每當它生成一個單元格時,UITableView調用cellForRowAtIndexPath 因此,只要您看到屬於同一行的行索引,就可以輕鬆地知道表格,行索引和總高度有多少個單元格到下一個屏幕頁面,您應該使用動畫隱藏導航欄。否則,如果所有行索引都屬於第一屏幕 - >用動畫顯示導航欄。
什麼是鼠標操作? – jer 2010-09-27 04:34:44
地獄在哪裏?您正在爲iPhone工作,而不是爲機器工作。 – 2010-09-27 04:49:55
喜歡光標移動到它應該顯示的導航欄上,當光標移動到屏幕上時,導航欄應該是不可見的 – iphoneStruggler 2010-09-27 04:49:56