久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何在 iphone 應用程序開發中的導航欄上添加 1

How can i add more than 10 buttons on a navigationbar in iphone application development?(如何在 iphone 應用程序開發中的導航欄上添加 10 多個按鈕?)
本文介紹了如何在 iphone 應用程序開發中的導航欄上添加 10 多個按鈕?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

在我的應用程序中,我必須在導航欄上添加 8 個按鈕.所以這些按鈕應該在視圖中并且應該有一個上一個和下一個按鈕是非常正常的.當我按下下一個按鈕然后使用動畫時,它將顯示下一個按鈕,這些按鈕不在視圖中并且與上一個按鈕相同.

詳情:

  1. UINavigation Bar -> leftBaritem[上一個按鈕] + view + rightBaritem[下一個按鈕];

  2. 視圖將包含 8 個按鈕.如果我再解釋一下,它應該是這樣的:

<塊引用>

上一個 + |一個 |乙|C |D |E |F |克|H + 下一個

我什么時候按

<塊引用>

下一個

然后它會顯示如下:

<塊引用>

上一個 + |乙|C |D |E |F |克|H + 下一個

喜歡這個

<塊引用>

上一頁

按鈕.

在這張圖片中,一個視圖中有三個按鈕,但我有六個按鈕可以添加到儀表板、訂單、產品"視圖上.現在當我按下>"或<"時或左/右欄項目,然后它將顯示導航欄的按鈕,這些按鈕不在視圖中.

解決方案

我解決這個問題的方式略有不同......

viewDidLoad 我有一個 scrollView 并調用了我的函數

menuScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0,0,320,40)];menuScrollView.showsHorizo??ntalScrollIndicator = FALSE;menuScrollView.showsVerticalScrollIndicator = FALSE;menuScrollView.bounces = TRUE;[self createMenuWithButtonSize:CGSizeMake(70.0, 30.0) withOffset:20.0f noOfButtons:7];

然后在我的 function 中,我創建了我的菜單 buttons,它看起來像 navigation bar

上的按鈕

-(void)createMenuWithButtonSize:(CGSize)buttonSize withOffset:(CGFloat)offset noOfButtons:(int)totalNoOfButtons{NSLog(@"插入菜單欄按鈕創建函數");for (int i = 0; i < totalNoOfButtons; i++) {UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];[按鈕 addTarget:self action:@selector(mybuttons:) forControlEvents:UIControlEventTouchUpInside];如果(我==0){[button setTitle:[NSString stringWithFormat:@"Dashboard"] forState:UIControlStateNormal];//帶標題}否則如果(i==1){[button setTitle:[NSString stringWithFormat:@"Order"] forState:UIControlStateNormal];//帶標題}否則如果(i==2){[button setTitle:[NSString stringWithFormat:@"Product"] forState:UIControlStateNormal];//帶標題}否則如果(i==3){[button setTitle:[NSString stringWithFormat:@"Customers"] forState:UIControlStateNormal];//帶標題}否則如果(i==4){[button setTitle:[NSString stringWithFormat:@"Content"] forState:UIControlStateNormal];//帶標題}否則如果(i==5){[button setTitle:[NSString stringWithFormat:@"Site Analysis"] forState:UIControlStateNormal];//帶標題}否則如果(i==6){[button setTitle:[NSString stringWithFormat:@"Store Settings"] forState:UIControlStateNormal];//帶標題}否則如果(i==7){[button setTitle:[NSString stringWithFormat:@"CMS Settings"] forState:UIControlStateNormal];//帶標題}button.frame = CGRectMake(i*(offset+buttonSize.width), 8.0, buttonSize.width, buttonSize.height);button.clipsToBounds = YES;button.showsTouchWhenHighlighted=YES;button.layer.cornerRadius = 0;//寬度的一半//button.layer.borderColor=[UIColor clearColor];button.layer.backgroundColor=[UIColor blueColor].CGColor;button.titleLabel.font = [UIFont systemFontOfSize:10];button.layer.borderWidth=0.0f;按鈕.標簽=我;[menuScrollView addSubview:button];}menuScrollView.contentSize=CGSizeMake((buttonSize.width + offset) * totalNoOfButtons, buttonSize.height);[self.view addSubview:menuScrollView];}

它解決了...快樂編碼... :))

In my application I have to add 8 buttons on a navigation bar..So it's very much normal that these button should be in a view and there should be one previous and next button. When i will press the next button then using animation it will show the next buttons whose are out of the view and same as for previous button.

For Details:

  1. UINavigation Bar -> leftBaritem[previous button] + view + rightBaritem[next button];

  2. view will contain 8 buttons. If I explain again then it should be look like this:

Previous + | A | B | C | D | E | F | G | H + next

when I will press

next

then it will show like this:

previous + | B | C | D | E | F | G | H + next

like this for

previous

button.

EDIT:

In this picture there are three button in a view but i have six button to add on the view "Dashbord , order , Product". Now when i will press ">" or "<" or left/right bar items then it will show the buttons of the nav bar which are out of the view.

解決方案

I have solve this problem slightly different way....

In viewDidLoad I have take a scrollView and called my function

menuScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0,0,320,40)];
menuScrollView.showsHorizontalScrollIndicator = FALSE;
menuScrollView.showsVerticalScrollIndicator = FALSE;
menuScrollView.bounces = TRUE;


[self createMenuWithButtonSize:CGSizeMake(70.0, 30.0) withOffset:20.0f noOfButtons:7];

Then in my function i have created my menu buttons which will be look like buttons on a navigation bar

-(void)createMenuWithButtonSize:(CGSize)buttonSize withOffset:(CGFloat)offset noOfButtons:(int)totalNoOfButtons{

NSLog(@"inserting into the function for menu bar button creation"); 
for (int i = 0; i < totalNoOfButtons; i++) {

    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];

    [button addTarget:self action:@selector(mybuttons:) forControlEvents:UIControlEventTouchUpInside];
    if(i==0){
    [button setTitle:[NSString stringWithFormat:@"Dashboard"] forState:UIControlStateNormal];//with title
    }
    else if(i==1){
        [button setTitle:[NSString stringWithFormat:@"Order"] forState:UIControlStateNormal];//with title
    }
    else if(i==2){
        [button setTitle:[NSString stringWithFormat:@"Product"] forState:UIControlStateNormal];//with title
    }
    else if(i==3){
        [button setTitle:[NSString stringWithFormat:@"Customers"] forState:UIControlStateNormal];//with title
    }
    else if(i==4){
        [button setTitle:[NSString stringWithFormat:@"Content"] forState:UIControlStateNormal];//with title
    }
    else if(i==5){
        [button setTitle:[NSString stringWithFormat:@"Site Analysis"] forState:UIControlStateNormal];//with title
    }
    else if(i==6){
        [button setTitle:[NSString stringWithFormat:@"Store Settings"] forState:UIControlStateNormal];//with title
    }
    else if(i==7){
        [button setTitle:[NSString stringWithFormat:@"CMS Settings"] forState:UIControlStateNormal];//with title
    }
    button.frame = CGRectMake(i*(offset+buttonSize.width), 8.0, buttonSize.width, buttonSize.height);
    button.clipsToBounds = YES;
    button.showsTouchWhenHighlighted=YES;
    button.layer.cornerRadius = 0;//half of the width
    //button.layer.borderColor=[UIColor clearColor];
    button.layer.backgroundColor=[UIColor blueColor].CGColor;
    button.titleLabel.font = [UIFont systemFontOfSize:10];
    button.layer.borderWidth=0.0f;
    button.tag=i;
    [menuScrollView addSubview:button];
}
menuScrollView.contentSize=CGSizeMake((buttonSize.width + offset) * totalNoOfButtons, buttonSize.height);
[self.view addSubview:menuScrollView];

}

and it solves...Happy Coding... :))

這篇關于如何在 iphone 應用程序開發中的導航欄上添加 10 多個按鈕?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Stop a UITableView from automatically scrolling(阻止 UITableView 自動滾動)
iOS UIScrollView Lazy Loading(iOS UIScrollView 延遲加載)
using iOS 6.0 SDK and building for iOS 5 Target causes UIScrollView setMinimumZoomScale to fail when running on iOS 5 simulator(在 iOS 5 模擬器上運行時,使用 iOS 6.0 SDK 并為 iOS 5 Target 構建會導致 UIScrollView setMinimumZ
Create partial-screen UIPageViewController programmatically(以編程方式創建部分屏幕 UIPageViewController)
how to make an ImageView zoomable with or without ScrollView.?(如何使用或不使用 ScrollView 使 ImageView 可縮放?)
UIImageView zoom and pinch in UIScrollView(UIImageView 在 UIScrollView 中縮放和捏合)
主站蜘蛛池模板: 久久久久91 | 夜久久 | 欧美精品一区二区在线观看 | 一区二区三区免费在线观看 | 久久久亚洲综合 | 中文字幕亚洲视频 | 97碰碰碰 | 亚洲精品电影 | 亚洲嫩草 | 天天干天天操天天爽 | 亚洲综合一区二区三区 | 成人亚洲视频 | 久热久 | www免费视频 | 国产精品久久久久久影院8一贰佰 | 怡红院免费的全部视频 | 欧美舔穴| 欧美色a v | 欧美日韩成人影院 | 国产精品高清在线 | 日本粉嫩一区二区三区视频 | 国产福利在线小视频 | 狠狠综合久久av一区二区老牛 | 日韩欧美国产精品 | 日日干天天干 | 亚洲网站免费看 | 免费视频一区二区 | 一本色道精品久久一区二区三区 | 91欧美 | 亚洲毛片在线观看 | 午夜精品一区二区三区免费视频 | a级黄色毛片免费播放视频 国产精品视频在线观看 | 91在线观看免费 | 国产中文视频 | 亚洲综合久久精品 | 国产成人精品一区二区三区网站观看 | 亚洲在线一区二区 | 99热精品6| 国产一区二区三区高清 | 三级视频在线观看 | 国内精品久久精品 |