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

如何在 iphone 應(yīng)用程序開發(fā)中的導(dǎo)航欄上添加 1

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

問題描述

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

詳情:

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

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

<塊引用>

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

我什么時候按

<塊引用>

下一個

然后它會顯示如下:

<塊引用>

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

喜歡這個

<塊引用>

上一頁

按鈕.

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

解決方案

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

viewDidLoad 我有一個 scrollView 并調(diào)用了我的函數(shù)

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 中,我創(chuàng)建了我的菜單 buttons,它看起來像 navigation bar

上的按鈕

-(void)createMenuWithButtonSize:(CGSize)buttonSize withOffset:(CGFloat)offset noOfButtons:(int)totalNoOfButtons{NSLog(@"插入菜單欄按鈕創(chuàng)建函數(shù)");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... :))

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

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

相關(guān)文檔推薦

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 構(gòu)建會導(dǎo)致 UIScrollView setMinimumZ
Create partial-screen UIPageViewController programmatically(以編程方式創(chuàng)建部分屏幕 UIPageViewController)
how to make an ImageView zoomable with or without ScrollView.?(如何使用或不使用 ScrollView 使 ImageView 可縮放?)
UIImageView zoom and pinch in UIScrollView(UIImageView 在 UIScrollView 中縮放和捏合)
主站蜘蛛池模板: 亚洲国产精品视频 | 国产在线观看一区二区三区 | 国产精品久久久久久久久久久久 | 国产日韩久久久久69影院 | 二区不卡 | 草草视频在线播放 | 免费观看一级黄色录像 | 国产激情视频在线免费观看 | 一a级片| 日本黄色影片在线观看 | 热久久久 | 中国xxxx性xxxx产国 | 亚洲一区视频在线播放 | 亚洲一区二区三区在线播放 | 日韩av在线中文字幕 | 日韩欧美手机在线 | 欧美二三区 | av资源网站 | 国产一级电影在线 | 在线看av网址 | 亚洲视频在线免费观看 | 天天操人人干 | 真人女人一级毛片免费播放 | 欧美日韩在线观看视频网站 | 国产精品一区网站 | 国产视频久久久久 | 欧美日韩免费视频 | 国产高清免费在线 | 日韩av在线中文字幕 | 96国产精品久久久久aⅴ四区 | 日本成人一区二区 | 久久在线 | 欧美性久久久 | 日本超碰 | 天堂网avav | 夜夜骚| www天天操| 黑人精品欧美一区二区蜜桃 | 成年人免费看的视频 | 人成精品 | 蜜桃色网 |