pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

如何在 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 中縮放和捏合)
主站蜘蛛池模板: 岩石钻裂机-液压凿岩机-劈裂机-挖改钻_湖南烈岩科技有限公司 | 合肥弱电工程_安徽安防工程_智能化工程公司-合肥雷润 | 新型游乐设备,360大摆锤游乐设备「诚信厂家」-山东方鑫游乐设备 新能源汽车电池软连接,铜铝复合膜柔性连接,电力母排-容发智能科技(无锡)有限公司 | 炭黑吸油计_测试仪,单颗粒子硬度仪_ASTM标准炭黑自销-上海贺纳斯仪器仪表有限公司(HITEC中国办事处) | 轻型地埋电缆故障测试仪,频响法绕组变形测试仪,静荷式卧式拉力试验机-扬州苏电 | 厂房出租-厂房规划-食品技术-厂房设计-厂房装修-建筑施工-设备供应-设备求购-龙爪豆食品行业平台 | 防火门|抗爆门|超大门|医疗门|隔声门-上海加汇门业生产厂家 | 深圳宣传片制作_产品视频制作_深圳3D动画制作公司_深圳短视频拍摄-深圳市西典映画传媒有限公司 | 干培两用箱-细菌恒温培养箱-菲斯福仪器 | 岩石钻裂机-液压凿岩机-劈裂机-挖改钻_湖南烈岩科技有限公司 | 承插管件_不锈钢承插管件_锻钢高压管件-温州科正阀门管件有限公司 | 儿童语言障碍训练-武汉优佳加感统文化发展有限公司 | 法兰连接型电磁流量计-蒸汽孔板节流装置流量计-北京凯安达仪器仪表有限公司 | 北京租车公司_汽车/客车/班车/大巴车租赁_商务会议/展会用车/旅游大巴出租_北京桐顺创业租车公司 | 球磨机,节能球磨机价格,水泥球磨机厂家,粉煤灰球磨机-吉宏机械制造有限公司 | 电脑知识|软件|系统|数据库|服务器|编程开发|网络运营|知识问答|技术教程文章 - 好吧啦网 | 液氮罐_液氮容器_自增压液氮罐_杜瓦瓶_班德液氮罐厂家 | 欧美日韩国产一区二区三区不_久久久久国产精品无码不卡_亚洲欧洲美洲无码精品AV_精品一区美女视频_日韩黄色性爱一级视频_日本五十路人妻斩_国产99视频免费精品是看4_亚洲中文字幕无码一二三四区_国产小萍萍挤奶喷奶水_亚洲另类精品无码在线一区 | 氟氨基酮、氯硝柳胺、2-氟苯甲酸、异香兰素-新晨化工 | 污水提升器,污水提升泵,地下室排水,增压泵,雨水泵,智能供排水控制器-上海智流泵业有限公司 | 法兰连接型电磁流量计-蒸汽孔板节流装置流量计-北京凯安达仪器仪表有限公司 | 恒湿机_除湿加湿一体机_恒湿净化消毒一体机厂家-杭州英腾电器有限公司 | 防水套管|柔性防水套管|伸缩器|伸缩接头|传力接头-河南伟创管道 防水套管_柔性防水套管_刚性防水套管-巩义市润达管道设备制造有限公司 | 联系我们老街华纳娱乐公司官网19989979996(客服) | 小型单室真空包装机,食品单室真空包装机-百科 | 全温恒温摇床-水浴气浴恒温摇床-光照恒温培养摇床-常州金坛精达仪器制造有限公司 | 粘弹体防腐胶带,聚丙烯防腐胶带-全民塑胶| YJLV22铝芯铠装电缆-MYPTJ矿用高压橡套电缆-天津市电缆总厂 | 环比机械| 密封圈_泛塞封_格莱圈-[东莞市国昊密封圈科技有限公司]专注密封圈定制生产厂家 | X光检测仪_食品金属异物检测机_X射线检测设备_微现检测 | 对辊破碎机_四辊破碎机_双齿辊破碎机_华盛铭重工 | 迪威娱乐|迪威娱乐客服|18183620002 | 气动调节阀,电动调节阀,自力式压力调节阀,切断阀「厂家」-浙江利沃夫自控阀门 | 专业生产动态配料系统_饲料配料系统_化肥配料系统等配料系统-郑州鑫晟重工机械有限公司 | 金属雕花板_厂家直销_价格低-山东慧诚建筑材料有限公司 | 拉卡拉POS机官网 - 官方直营POS机办理|在线免费领取 | 天津拓展_天津团建_天津趣味运动会_天津活动策划公司-天津华天拓展培训中心 | 台湾Apex减速机_APEX行星减速机_台湾精锐减速机厂家代理【现货】-杭州摩森机电 | 工业制氮机_psa制氮机厂家-宏骁智能装备科技江苏有限公司 | 老城街小面官网_正宗重庆小面加盟技术培训_特色面馆加盟|牛肉拉面|招商加盟代理费用多少钱 |