Fork me on GitHub

文章分类 -  interface

1 2 3 下一页

界面控件
nib和xib的区别
摘要:nib是NeXT Interface Builder的缩写。xib 是xml nib文件,于2007年 Leopard (and Xcode 3.0) 版本中更新。以源码方式打开查看:< ?xml version="1.0" encoding="UTF-8"?>78410F2521……相同点:NIB 和 XIB 都是 Interface Builder 的图形界面设计文档。Interface Builder 把窗口、菜单栏以及窗口上的各种控件的对象都“冻结”在了一个 NIB文档里面了;程序运行时,这些对象将会“苏醒”。不同点:NIB为二进制文 阅读全文

posted @ 2012-05-25 14:14 pengyingh 阅读(3907) 评论(0) 推荐(1) 编辑

当UINavigationController作为UIViewController之后如何去除上部的空白
摘要:http://www.10bay.com/一般来说UINavigationController是作为UIWindow的子view来使用的,例如当你创建一个Navigation类型的应用程序时,系统会将AppDelegate中的navigationController做为window的根控制器self.window.rootViewController = self.navigationController; [self.window.makeKeyAndVisible];UINavigationController在放置自己的位置时,会默认考虑到状态条,并在顶部留出20px的空白位置。但是当将 阅读全文

posted @ 2012-05-15 19:31 pengyingh 阅读(1186) 评论(0) 推荐(0) 编辑

Modal View Controller的不同呈现类型
摘要:ModalViewController可以有不同的呈现类型(modalPresentationStyle),在ipad下要提供多方向支持时,就要注意可能要改变ModalViewController的呈现方式,列举如下:1. UIModalPresentationFullScreen:全屏模式,即弹出窗口占满整个屏幕,在portrait模式和landscape模式下都一样。2. UIModalPresentationFormSheet:会将窗口缩小,使之居于屏幕中间,在portrait和landscape下都一样,但要注意landscape下如果软键盘出现,窗口位置会调整。3. UIModalP 阅读全文

posted @ 2012-05-15 19:29 pengyingh 阅读(585) 评论(0) 推荐(0) 编辑

UILabel
摘要:http://stackoverflow.com/questions/990221/multiple-lines-of-text-in-uilabelMultiple lines of text in UILabeltextLabel.lineBreakMode = UILineBreakModeWordWrap;textLabel.numberOfLines = 0;it does't work in my case. I'm doing like this:- (CGFloat)tableView:(UITableView *)tableView heightForRowA 阅读全文

posted @ 2012-04-20 14:22 pengyingh 阅读(1466) 评论(0) 推荐(0) 编辑

默认横屏
摘要:在info.plist中增加一项:<key>UIInterfaceOrientation</key><string>UIInterfaceOrientationLandscapeRight</string>再加一项 initial interface orientationLandscape(right)View- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {// Return YES for supporte 阅读全文

posted @ 2012-04-11 14:29 pengyingh 阅读(242) 评论(0) 推荐(0) 编辑

[iOS开发必备技巧之]禁用UITabBarController双击事件
摘要:很多时候我们的程序操作结构都是UITabBarController+UINavigationController,每个UITabBarController item里面都有很多层的UINavigationController,而UITabBarController默认有一个事件就是双击UITabBarController item时,会把这个item里的UINavigationController pop 到root,而我们有时不希望一下子就pop到了根视图,因为可能还会有一些逐层处理功能需要完成。这个时候如果想屏闭掉这个双击事件只留下单击切换标签事件的话,就可以参考下面的方法重写UITabB 阅读全文

posted @ 2012-04-04 22:56 pengyingh 阅读(792) 评论(0) 推荐(0) 编辑

ViewController问题小结
摘要:http://www.cppblog.com/zhangyuntaoshe/articles/123822.html?opt=admin1.UIViewController:重要属性:viewtitleinterfaceOrientationtabBarControllertabBarItemnavigationControllernavigationItemparentViewController重要方法:viewDidLoadviewDidUnloadviewWillAppearviewWIllDisappearpresentModalViewControllerdismissModalV 阅读全文

posted @ 2012-04-04 21:45 pengyingh 阅读(213) 评论(0) 推荐(0) 编辑

禁用UITabBarController双击事件
摘要:http://blog.csdn.net/ipromiseu/article/details/7031084很多时候我们的程序操作结构都是UITabBarController+UINavigationController,每个UITabBarController item里面都有很多层的UINavigationController,而UITabBarController默认有一个事件就是双击UITabBarController item时,会把这个item里的UINavigationController pop 到root,而我们有时不希望一下子就pop到了根视图,因为可能还会有一些逐层处理功 阅读全文

posted @ 2012-04-02 13:49 pengyingh 阅读(1047) 评论(0) 推荐(0) 编辑

UITabBarController 标签栏控制器
摘要:文章:http://blog.csdn.net/iukey/article/details/7318290在 UIKit 中UITabbar 代表了标签栏,而 UITabBarController 对其进行了封装,令多个不同的视图管理与切换变的更加轻松。构建一个标签栏控制器,首先要为每个按钮准备一个单独的页。每一页都应被创建为UIViewController对象。构建一个控制器数组:你的应用程序可能有多个不同的试图控制器,来实现不同的功能。如果你在写一个音乐播放器,可能会有一些控制器,如:MusicList、CurrentPlay、Favourite、SingerList、Settings 等 阅读全文

posted @ 2012-04-02 12:19 pengyingh 阅读(1240) 评论(1) 推荐(0) 编辑

让 UILabel 垂直方向顶端对齐的代码
摘要:UILabel 里放入多行文字,会发现 label 默认居中对齐,很不符合左对齐的传统习惯,下面这段 CocoaChina 版主“angellixf”分享的代码可以让 UILabel 以垂直方向顶端对齐,也就是我们常说的左对齐或右对齐////VerticallyAlignedLabel.h//#import <Foundation/Foundation.h>typedef enum VerticalAlignment {VerticalAlignmentTop,VerticalAlignmentMiddle,VerticalAlignmentBottom,} VerticalAli 阅读全文

posted @ 2012-03-26 17:16 pengyingh 阅读(667) 评论(0) 推荐(0) 编辑

为UIKeyboardTypeNumberPad增加自定义按键
摘要:在 iPhone 上面開發應用程式時, 在使用輸入鍵盤時, 或多或少都會遇到客制化鍵盤的問題, 這邊筆者以簡單的數字鍵盤來示範客制化的動作. 這部份我想網路上已經有不少 sample code , 但大部份基本上都是以 SDK 3.x 的版本去實作, 以"特定寫法"來實作客制化在 iOS4 會有問題, 這部份稍候會提到兩版本的差異.上述看到的例子是UIKeyboardTypeNumberPad搭配 "Done" 的圖示所組合而成的. 在開始介紹如何實作之前, 先稍微提一下網路上查到的一些範例寫法. 因為 SDK 升版之後在架構上有做了些修改, 所以導致行 阅读全文

posted @ 2012-03-26 16:45 pengyingh 阅读(6851) 评论(0) 推荐(0) 编辑

UINavagationBar,UISearchBar,UIToolBar,UITabBar 自定义 Background Image
摘要:这里运用了 object-c里面的一个类别,大体意思就是在不知道苹果封装起来的API内容的情况下,在外部程序中覆盖其原来的函数。大体这个意思吧。程序代码: 在程序的任何一个 .m文件 后面加上下面代码即可 记住 要在 @end 的后面加上;@implementation UINavigationBar (CustomImage2)- (void)drawRect:(CGRect)rect { UIImage *image = [UIImage imageNamed: @"bar.png"]; [image drawInRect:CGRectMake(0, 0, self.f 阅读全文

posted @ 2012-03-26 10:33 pengyingh 阅读(973) 评论(0) 推荐(0) 编辑

隐藏tabBar
摘要:- (void) hideTabBar:(BOOL) hidden{[UIView beginAnimations:nil context:NULL];if (hidden){[UIView setAnimationDuration:0];} else {[UIView setAnimationDuration:0];}for(UIView *view in self.tabBarController.view.subviews){if([view isKindOfClass:[UITabBar class]]){if (hidden) {[view setFrame:CGRectMake(v 阅读全文

posted @ 2012-03-25 11:53 pengyingh 阅读(170) 评论(0) 推荐(0) 编辑

iPhone开发:类似iChat的聊天泡泡示例
摘要:很多iPhone聊天程序消息显示都喜欢做成iChat的泡泡样式,这样是不是很apple呢?那么下面用一种简单的方法来实现它。主要通过UIlabel的sizeToFit方法自动计算文本区域大小UIImage的- (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight;方法拉伸图片可以根据文本内容自动适应算泡泡高度- (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWid 阅读全文

posted @ 2012-03-19 10:29 pengyingh 阅读(367) 评论(0) 推荐(0) 编辑

【项目经验】iphone自定义状态栏
摘要:#import <Foundation/Foundation.h> //自定义状态栏,状态栏显示灰色背景并【indicator message】。用于耗时操作的状态栏信息提示 //例如:访问网络时,提示正在获取网络数据,或者正在提交数据至服务器等提示 @interface CHStatusBar : UIWindow { @private UILabel *lblStatus; UIActivityIndicatorView *indicator; } -(void)show... 阅读全文

posted @ 2012-03-10 15:35 pengyingh 阅读(647) 评论(0) 推荐(0) 编辑

UIViewController旋转方法
摘要:什么对象是dipatching的UIViewController旋转的方法调用,即负责:- shouldAutorotateToInterfaceOrientation:- willRotateToInterfaceOrientation:时间:- willAnimateFirstHalfOfRotationToInterfaceOrientation:时间:- willAnimateSecondHalfOfRotationFromInterfaceOrientation:时间:- didRotateFromInterfaceOrientation:我猜想,UIApplication(但也许是 阅读全文

posted @ 2012-03-06 15:54 pengyingh 阅读(1931) 评论(0) 推荐(0) 编辑

tabBar选项卡的背景色如何修改(自定义tabBar)&&推送nav到指定(根)视图控制器
摘要:在tabBar区域加个视图CGRect frame = CGRectMake(0,0,320,48); UIView *v = [[UIView alloc]initWithFrame:frame]; [v setBackgroundColor:[[UIColor allor]initWithRed:70.0/255.0 green:65.0/255.0 blue:62.0/255.0 alpha:1.0]]; [rootController.tabBar insertSubview:v atIndex:0]; [v release];注意:addSubview是将view添加到... 阅读全文

posted @ 2012-03-06 13:37 pengyingh 阅读(4566) 评论(0) 推荐(0) 编辑

ios开发中如何隐藏各种bar
摘要:状态条Status Bar[UIApplication sharedApplication].statusBarHidden = YES;或者// iOS3.2+支持[application setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade];statusBarHidden属性支持在iOS2.0+,setStatusBarHidden:animated:方法在iOS3.2中开始取消了,而采用了setStatusBarHidden:withAnimation:方法。上述方法只能实现在程序跳过loading(即启动画面)的时候 阅读全文

posted @ 2012-03-06 13:29 pengyingh 阅读(4215) 评论(0) 推荐(0) 编辑

自定义组件,拖拽BUTTON
摘要:一、头文件#import<UIKit/UIKit.h>@interface DragIcon :UIView //拖动的视图{ CGPoint lastLoction; BOOL moveChanged; CGPoint touchBeginPoint; CGPoint touchMovedPoint; CGPoint touchEndPoint;}@property(nonatomic)CGPoint lastLoction;@property(nonatomic,assign)id delegate;@end@interface NQScrol... 阅读全文

posted @ 2012-03-06 11:28 pengyingh 阅读(315) 评论(0) 推荐(0) 编辑

改变Alert的背景图片
摘要:UIAlertView *theAlert = [[[UIAlertView alloc] initWithTitle:@"Atention" message: @"XXXXX!" delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles:@"Okay",nil] autorelease];[theAlert show]; UIImage *theImage = [UIImage imageNamed:@"XXX.png"]; theI 阅读全文

posted @ 2012-03-03 23:35 pengyingh 阅读(691) 评论(0) 推荐(0) 编辑

1 2 3 下一页

导航