久久久久久久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 多個(gè)按鈕?)
本文介紹了如何在 iphone 應(yīng)用程序開發(fā)中的導(dǎo)航欄上添加 10 多個(gè)按鈕?的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

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

詳情:

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

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

<塊引用>

上一個(gè) + |一個(gè) |乙|C |D |E |F |克|H + 下一個(gè)

我什么時(shí)候按

<塊引用>

下一個(gè)

然后它會(huì)顯示如下:

<塊引用>

上一個(gè) + |乙|C |D |E |F |克|H + 下一個(gè)

喜歡這個(gè)

<塊引用>

上一頁

按鈕.

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

解決方案

我解決這個(gè)問題的方式略有不同......

viewDidLoad 我有一個(gè) 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];//帶標(biāo)題}否則如果(i==1){[button setTitle:[NSString stringWithFormat:@"Order"] forState:UIControlStateNormal];//帶標(biāo)題}否則如果(i==2){[button setTitle:[NSString stringWithFormat:@"Product"] forState:UIControlStateNormal];//帶標(biāo)題}否則如果(i==3){[button setTitle:[NSString stringWithFormat:@"Customers"] forState:UIControlStateNormal];//帶標(biāo)題}否則如果(i==4){[button setTitle:[NSString stringWithFormat:@"Content"] forState:UIControlStateNormal];//帶標(biāo)題}否則如果(i==5){[button setTitle:[NSString stringWithFormat:@"Site Analysis"] forState:UIControlStateNormal];//帶標(biāo)題}否則如果(i==6){[button setTitle:[NSString stringWithFormat:@"Store Settings"] forState:UIControlStateNormal];//帶標(biāo)題}否則如果(i==7){[button setTitle:[NSString stringWithFormat:@"CMS Settings"] forState:UIControlStateNormal];//帶標(biāo)題}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;按鈕.標(biāo)簽=我;[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 多個(gè)按鈕?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 自動(dòng)滾動(dòng))
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 模擬器上運(yùn)行時(shí),使用 iOS 6.0 SDK 并為 iOS 5 Target 構(gòu)建會(huì)導(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 中縮放和捏合)
主站蜘蛛池模板: 中日韩一级片 | 91黄色片| 免费看黄色小视频 | 欧美激情久久久 | 人人艹人人爱 | 欧美超碰在线 | 视频一区在线观看 | 日韩精品视频网站 | 日韩欧美在线一区 | brazzers精品成人一区 | 亚洲人天堂 | 色影视| 91极品视频 | 免费特级毛片 | 奇米影视亚洲春色 | 日韩一区二区在线播放 | 丁香综合网 | 日韩欧美专区 | 久久免费国产 | 国产三级久久 | 日韩精品久久久 | 欧美日韩性| 美女扒开腿让人桶爽原神 | 亚洲伊人影院 | 一区在线观看视频 | 曰韩一级片 | 青青草免费在线视频 | 久久人体| 91精品国产综合久久久蜜臀九色 | 天天干干干 | 98在线视频 | 中文字幕日韩高清 | 国语对白永久免费 | 欧美三级韩国三级日本三斤在线观看 | 色婷婷基地 | 97国产在线 | 欧美美女视频 | 日韩av在线免费 | 国产精品国产精品国产专区不片 | 中文字幕在线免费播放 | 夜夜嗨av一区二区三区网页 |