- 浏览: 340286 次
- 性别:
- 来自: 武汉
文章分类
最新评论
-
leslie89757:
[img][img][img][img][img][img][ ...
CocoaPods 安装使用 -
hanmeizhi:
very useful to me. Thanks
Dismissing MPMoviePlayerViewController the right way -
luzj:
这个考虑不周全, 在iOS5的键盘高度就不是这个值了,这样写死 ...
UITextView: move view when keyboard appears -
xjg19870111:
不错。
objective-c NSString 常用操作 -
juedui0769:
现在已经不行了!
android源码下载
1. 在uiviewcontroller声明nsstring property的方法:
NSString *groupName;
@property (nonatomic, assign) NSString *groupName;
2.Setting the back button title of a UINavigationItem
The following code will set the back button title of the current UINavigationItem:
The target: and action: parameters are definitely ignored (replaced by the default back button behavior) and the style also seems to be ignored because the back button retains its pointed left side.
This next block of code looks like it should do the same thing but does not work:
self.navigationItem.backBarButtonItem.title = [NSString stringWithString:@"Back"];
注意:一定要在当前页面设置backbarbuttonitem!!
MAJOR CAVEAT: As pointed out in this thread, "the back button is 'owned' by the previous view on the stack." In other words, the setBackBarButtonItem method should be called on the view that the user is navigating away from, rather than the view above which this button is actually displayed.
3. 调整tableviewcell 背景色
4. ipad 背景透明
tableView.backgroundColor = [UIColor clearColor];
在iPhone上可以透明,但是在iPad上无效,
解决方案:ttable.backgroundView.alpha = 0;
5. 图标 资源
Ever reach a brick wall in designing your app due to a shortage of artwork? I ran into this situation this morning, and figured I’d share what I’ve found for others that might be similarly design handicapped.
iPhone Tab Bar Icons
GlyFX has a few sets available for purchase at http://www.glyfx.com/shop/listing/iphone/
GLYPHISH has a large set for free at http://glyphish.com/
Quality Icons Blog has a few free gaming focused icons available here http://qualityicons.blogspot.com/2009/08/iphone-tab-bar-gaming-icons.html
eddit has a 160+ icon set you can purchase here http://www.eddit.com/shop/iphone_ui_icon_set/
kombine has a 130+ icon set for sale at http://www.kombine.net/icon-store/iphone-tab-bar-icons
Just remember your app can get rejected for the incorrect use of icons or breaking the iPhone Human Interface Guidelines. I found the blog post “icon fail” by Under the Bridge extremely helpful in understanding the importance of selecting your icons.
6. How to make your own tab bar icon
http://www.youtube.com/watch?v=YUWMeJq9f-8
http://www.aha-soft.com/faq/ios-toolbar-icons.htm
http://speckyboy.com/2010/04/30/iphone-and-ipad-development-gui-kits-stencils-and-icons/
7. 各种图标尺寸
http://www.axialis.com/tutorials/make-ipad-icons.html#t2
8. Resizing a UITableViewCell to Hold Variable Amounts of Text
http://www.raddonline.com/blogs/geek-journal/iphone-sdk-resizing-a-uitableviewcell-to-hold-variable-amounts-of-text/
9. RoundedUITableView for iOS
http://www.cocoacontrols.com/platforms/ios/controls/roundeduitableview
10. 从navigationcontroller隐藏toolbar时隐藏动画会产生阴影,解决办法时不使用navigationcontroller自带的toolbar,自己在uiview中添加toolbar:
11. How to compare if two objects are really the same object?
The == operator tests whether the two expressions are the same pointer to the same object. Cocoa calls this relation “identical” (see, for example, NSArray's indexOfObjectIdenticalTo:).
To test whether two objects are equal, you would send one of them an isEqual: message (or a more specific message, such as isEqualToString:, if it responds to one), passing the other object. This would return YES if you really only have one object (equal to itself, obviously) or if you have two objects that are equal. In the latter case, == will evaluate to NO.
12. IOS支持的所有字体 font
http://iosfonts.com/
13. Advanced App Tricks
http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/AdvancedAppTricks/AdvancedAppTricks.html
14. 输入密码界面:
https://github.com/Koolistov/Passcode
http://code.google.com/p/kpasscode/
15. 程序和iTunes间共享文件
http://www.alterplay.com/ios-dev-tips/2010/11/file-sharing-from-app-to-itunes-is-too-easy.html
16. http://stackoverflow.com/questions/7989968/iphone-loading-view-slide-effect
1、判断一个view有没有superView
if ( [scrollView superviews] )
{
[scrollView removeFromSuperView];
}
else
{
[self.view addSubView:scrollView];
}
2、去除tableview的蓝色选中
吧tableview的Selection改为No Selection即可。
3、如何调用父view的controller里面的方法
[[self superview ].nextResponder method];
[[[self superview ] nextResponder] method];
[self.nextResponder method];
上面的都可以,看情况使用,使用的时候最好判断一下。
官方解释
UIView implements this method by returning the UIViewController object that manages it (if it has one) or its superview (if it doesn’t); UIViewController implements the method by returning its view’s superview; UIWindow returns the application object, and UIApplication returns nil.
4、如何隐藏tab bar controller 的tab bar
在Iphone编程中,很多人喜欢把Tab bar controller和Nav 一起混合使用,在点击了Tab bar上面的一个按钮切换到另一个view的时候,界面上的Tab Bar 没有消失.
导致view有部分的界面给遮挡了.所以需要把Tab Bar 给隐藏掉,隐藏代码如下:
self.newView = [[newViewController alloc] init];
newView.hidesBottomBarWhenPushed=YES;
[self.navigationController presentModalViewController:newView animated:YES];
在建立新的View的时候加入
newView.hidesBottomBarWhenPushed=YES;
即可使Tab Bar消失掉.
5、
UISearchBar 动作处理
/*取消按钮*/
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar{
[self doSearch:searchBar];
}
/*键盘搜索按钮*/
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar{
[searchBar resignFirstResponder];
[self doSearch:searchBar];
}
/*搜索*/
- (void)doSearch:(UISearchBar *)searchBar{
...
}
UISearchBar上按钮的默认文字为Cancel,如果想改为其他文字请调用一下代码
for(id cc in [searchtext subviews]){
if([cc isKindOfClass:[UIButton class]]){
UIButton *btn = (UIButton *)cc;
[btn setTitle:@"取消" forState:UIControlStateNormal];
}
}
注意:需要在.h文件种添加
<UISearchBarDelegate>,然后在.m文件种设置SearchBar的委托为:
self.SearchBar.delegate =self; 才可以生效。
6、控制Default.png图片的显示时间
直接在delegate里
sleep(想延长的秒数);
7、将UISearchBar 键盘上的Search键改成其他名字:
UITextField *searchField = [[search subviews] lastObject];
[searchField setReturnKeyType:UIReturnKeyDone];
8、 UITabBarController点击下面TabBarItem菜单时,如何重新加载?
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
//NSLog(@"加载一次");
//在此添加每次加载的时候要执行的内容
}
NSString *groupName;
@property (nonatomic, assign) NSString *groupName;
2.Setting the back button title of a UINavigationItem
The following code will set the back button title of the current UINavigationItem:
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:nil action:nil]; [self.navigationItem setBackBarButtonItem:backButton]; [backButton release];
The target: and action: parameters are definitely ignored (replaced by the default back button behavior) and the style also seems to be ignored because the back button retains its pointed left side.
This next block of code looks like it should do the same thing but does not work:
self.navigationItem.backBarButtonItem.title = [NSString stringWithString:@"Back"];
注意:一定要在当前页面设置backbarbuttonitem!!
MAJOR CAVEAT: As pointed out in this thread, "the back button is 'owned' by the previous view on the stack." In other words, the setBackBarButtonItem method should be called on the view that the user is navigating away from, rather than the view above which this button is actually displayed.
3. 调整tableviewcell 背景色
UITableViewCell *bgView = [[UITableViewCell alloc] initWithFrame:CGRectZero]; bgView.backgroundColor=indexPath.row % 2? [UIColor colorWithRed:0.95 green:0.95 blue:0.95 alpha:1]: [UIColor whiteColor]; bgView.accessoryView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"disclosure.png"]]; cell.backgroundView=bgView; return cell;
4. ipad 背景透明
tableView.backgroundColor = [UIColor clearColor];
在iPhone上可以透明,但是在iPad上无效,
解决方案:ttable.backgroundView.alpha = 0;
5. 图标 资源
Ever reach a brick wall in designing your app due to a shortage of artwork? I ran into this situation this morning, and figured I’d share what I’ve found for others that might be similarly design handicapped.
iPhone Tab Bar Icons
GlyFX has a few sets available for purchase at http://www.glyfx.com/shop/listing/iphone/
GLYPHISH has a large set for free at http://glyphish.com/
Quality Icons Blog has a few free gaming focused icons available here http://qualityicons.blogspot.com/2009/08/iphone-tab-bar-gaming-icons.html
eddit has a 160+ icon set you can purchase here http://www.eddit.com/shop/iphone_ui_icon_set/
kombine has a 130+ icon set for sale at http://www.kombine.net/icon-store/iphone-tab-bar-icons
Just remember your app can get rejected for the incorrect use of icons or breaking the iPhone Human Interface Guidelines. I found the blog post “icon fail” by Under the Bridge extremely helpful in understanding the importance of selecting your icons.
6. How to make your own tab bar icon
http://www.youtube.com/watch?v=YUWMeJq9f-8
http://www.aha-soft.com/faq/ios-toolbar-icons.htm
http://speckyboy.com/2010/04/30/iphone-and-ipad-development-gui-kits-stencils-and-icons/
7. 各种图标尺寸
http://www.axialis.com/tutorials/make-ipad-icons.html#t2
8. Resizing a UITableViewCell to Hold Variable Amounts of Text
http://www.raddonline.com/blogs/geek-journal/iphone-sdk-resizing-a-uitableviewcell-to-hold-variable-amounts-of-text/
9. RoundedUITableView for iOS
http://www.cocoacontrols.com/platforms/ios/controls/roundeduitableview
10. 从navigationcontroller隐藏toolbar时隐藏动画会产生阴影,解决办法时不使用navigationcontroller自带的toolbar,自己在uiview中添加toolbar:
- (void)viewDidLoad { // Add a toolbar to the view CGRect toolbarFrame = CGRectMake(0, 372, 320, 44); UIToolbar *myToolbar = [[UIToolbar alloc] initWithFrame:toolbarFrame]; UIBarButtonItem *compassButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"compass.png"] style:UIBarButtonItemStyleBordered target:self action:@selector(zoomToCurrentLocation)]; compassButton.width = 30.0f; // make the button a square shape [myToolbar setItems:[NSArray arrayWithObject:compassButton] animated:NO]; [compassButton release]; [self.view addSubview:myToolbar]; [super viewDidLoad]; }
11. How to compare if two objects are really the same object?
The == operator tests whether the two expressions are the same pointer to the same object. Cocoa calls this relation “identical” (see, for example, NSArray's indexOfObjectIdenticalTo:).
To test whether two objects are equal, you would send one of them an isEqual: message (or a more specific message, such as isEqualToString:, if it responds to one), passing the other object. This would return YES if you really only have one object (equal to itself, obviously) or if you have two objects that are equal. In the latter case, == will evaluate to NO.
12. IOS支持的所有字体 font
http://iosfonts.com/
13. Advanced App Tricks
http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/AdvancedAppTricks/AdvancedAppTricks.html
14. 输入密码界面:
https://github.com/Koolistov/Passcode
http://code.google.com/p/kpasscode/
15. 程序和iTunes间共享文件
http://www.alterplay.com/ios-dev-tips/2010/11/file-sharing-from-app-to-itunes-is-too-easy.html
16. http://stackoverflow.com/questions/7989968/iphone-loading-view-slide-effect
1、判断一个view有没有superView
if ( [scrollView superviews] )
{
[scrollView removeFromSuperView];
}
else
{
[self.view addSubView:scrollView];
}
2、去除tableview的蓝色选中
吧tableview的Selection改为No Selection即可。
3、如何调用父view的controller里面的方法
[[self superview ].nextResponder method];
[[[self superview ] nextResponder] method];
[self.nextResponder method];
上面的都可以,看情况使用,使用的时候最好判断一下。
官方解释
UIView implements this method by returning the UIViewController object that manages it (if it has one) or its superview (if it doesn’t); UIViewController implements the method by returning its view’s superview; UIWindow returns the application object, and UIApplication returns nil.
4、如何隐藏tab bar controller 的tab bar
在Iphone编程中,很多人喜欢把Tab bar controller和Nav 一起混合使用,在点击了Tab bar上面的一个按钮切换到另一个view的时候,界面上的Tab Bar 没有消失.
导致view有部分的界面给遮挡了.所以需要把Tab Bar 给隐藏掉,隐藏代码如下:
self.newView = [[newViewController alloc] init];
newView.hidesBottomBarWhenPushed=YES;
[self.navigationController presentModalViewController:newView animated:YES];
在建立新的View的时候加入
newView.hidesBottomBarWhenPushed=YES;
即可使Tab Bar消失掉.
5、
UISearchBar 动作处理
/*取消按钮*/
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar{
[self doSearch:searchBar];
}
/*键盘搜索按钮*/
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar{
[searchBar resignFirstResponder];
[self doSearch:searchBar];
}
/*搜索*/
- (void)doSearch:(UISearchBar *)searchBar{
...
}
UISearchBar上按钮的默认文字为Cancel,如果想改为其他文字请调用一下代码
for(id cc in [searchtext subviews]){
if([cc isKindOfClass:[UIButton class]]){
UIButton *btn = (UIButton *)cc;
[btn setTitle:@"取消" forState:UIControlStateNormal];
}
}
注意:需要在.h文件种添加
<UISearchBarDelegate>,然后在.m文件种设置SearchBar的委托为:
self.SearchBar.delegate =self; 才可以生效。
6、控制Default.png图片的显示时间
直接在delegate里
sleep(想延长的秒数);
7、将UISearchBar 键盘上的Search键改成其他名字:
UITextField *searchField = [[search subviews] lastObject];
[searchField setReturnKeyType:UIReturnKeyDone];
8、 UITabBarController点击下面TabBarItem菜单时,如何重新加载?
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
//NSLog(@"加载一次");
//在此添加每次加载的时候要执行的内容
}
发表评论
-
IOS7.1 企业应用 证书无效 已解决
2014-05-10 10:53 774http://www.cocoachina.com/bbs/r ... -
xCode Find&Replace快捷键
2013-10-28 10:44 907As for Find & Replace, they ... -
iOS整合zxing需要注意的地方
2013-08-02 23:34 2106Well, at last I got it working. ... -
iOS 自定义Tabbar
2013-07-30 22:55 1191http://www.appcoda.com/ios-prog ... -
Apple Push Notification Service总结
2013-07-29 22:39 1115苹果推送通知服务使用总结 1. 在 Mac 上从 KeyCha ... -
iOS 消息推送原理及实现
2013-07-12 13:40 856链接: http://www.dapps.net/dev/ ... -
GIMP IMAGE MAP
2013-05-29 16:13 853使用GIMP 制作 IMAGE MAP 1. 选择图片,用G ... -
INSPIRATION
2013-05-27 18:21 813http://www.patternsofdesign.co. ... -
iOS 自定义控件系列
2013-05-27 17:09 1481iOS自定义控件 自定义UITableViewCell ht ... -
CocoaPods 使用教程
2013-05-27 14:49 768http://mobile.tutsplus.com/tuto ... -
IOS 开发之设置UIButton的title
2013-05-11 22:03 1207btn.frame = CGRectMake(x, y, wi ... -
REActivityViewController 使用 备忘
2013-04-22 21:38 1058REActivityViewController Out o ... -
VPS配置二级域名
2013-04-18 23:08 7881. 域名解析商配置泛解析 主机记录 * 记录类型 A 2. ... -
ios 开发NewsStand指南
2013-04-13 21:44 1324http://www.viggiosoft.com/blog/ ... -
Python Django mod_wsgi Windows 部署过程 备忘
2013-04-10 18:28 1587部署环境:Windows2003Server 1. 安装Ap ... -
网站迁移 备忘
2013-04-10 14:58 7511. 备份数据库。。。导出的格式和编码要注意 2. 完全导出网 ... -
Windows下命令行查看端口占用
2013-04-09 23:42 723在windows命令行窗口下执行: C:\>netst ... -
带预览功能又可分页的UIScrollView
2013-04-05 12:56 823带预览功能又可分页的UIScrollView http:// ... -
25 iOS App 性能优化
2013-04-05 10:51 695http://www.raywenderlich.com/ ... -
UIScrollView滚动, 中间显示整图, 前后露出部分图
2013-04-04 00:12 1200UIScrollView *scrollowView = [[ ...
相关推荐
以下是一些实用的苹果手机技巧,帮助你更好地发掘iPhone的潜力。 1. **撤销键入与重做键入**:在编写短信或邮件时,如果误输入内容,只需轻轻晃动iPhone,系统会弹出一个窗口,选择“撤销键入”即可快速清除全部...
以下是一些针对iPad新用户的必备小技巧: 1. **锁屏界面启动“数码相框”**:在锁屏状态下,点击解锁滑块右侧的按钮,iPad会变成一个数码相框,展示你的照片并提供多种过渡效果。 2. **自定义静音开关**:在“设置...
iPhone是一款由苹果公司设计、开发并销售的智能手机系列。本章节介绍的是适用于iOS 5.0软件版本的iPhone使用手册。iOS 5.0是苹果公司在2011年发布的一个重要更新,引入了多项新功能和改进。 **配件** iPhone的标配...
### iPhone使用说明书知识点详解 #### 一、激活与设置iPhone **所需条件:** - 新的两年期无线服务计划...无论是新手用户还是老玩家都能从中找到实用的操作指南和技巧建议,帮助更好地利用这款智能设备提升生活质量。
10. **调整字号大小**:如果你觉得iPhone的默认字号不适合阅读,可以在设置-通用-辅助功能-大文本中选择适合的字号大小,让日历、通信录、短信、邮件和备忘录更易读。 11. **大写字母锁定**:启用“设置-通用-键盘-...
以下是一些iPhone的实用技巧和不为人知的功能: 1. 快速删除短信:在编写短信时,如果想一次性清除所有内容,只需晃动iPhone,然后选择“撤销键入”即可快速删除。若想恢复已删除的内容,再次晃动手机并选择“重做...
在苹果手机的使用中,有许多不为人知的功能和技巧,这些小窍门能让你的iPhone发挥出更大的价值。以下是一些实用的iPhone使用技巧: 1. 快速删除短信内容:在编写短信时,如果想要全部删除,只需轻轻摇动你的iPhone...
以下是一些iPhone的实用技巧和隐藏功能,可以帮助你更好地利用你的设备。 1. 快速删除与恢复文本:在编写短信时,如果想要全部删除,只需轻轻摇动iPhone,会出现“撤销键入”的选项,一键清空内容。若要恢复,再次...
读者在阅读本书后,可以掌握Objective-C语言的基本内容,并进行实际的iPhone/iPad和Mac应用开发。 《Objective-C程序设计》共分成11章。前6章讲述Objective-C语言,包括数据类型、运算符、表达式、条件语句、循环...
在iOS应用开发中,`UITextView` 是一个非常重要的组件,它用于显示和编辑多行文本,常用于创建日记、备忘录或者任何需要用户输入大量文本的场景。在这个实例中,开发者模仿了iPhone上的Notes.app,创建了一个具有...
苹果设备,尤其是iPhone,拥有众多隐藏的高效使用技巧,这些技巧可以帮助用户充分利用设备的功能,提升使用体验。以下是一些iPhone的实用操作和设置方法: 1. **撤销与重做输入**:在编写短信时,若想要快速删除...
Mojave还加强了与iOS设备的集成,其中Continuity Camera功能可以让用户直接从Mac上访问iPhone相机,拍摄的照片会自动出现在Mac上指定的应用程序中,非常适合会议记录或者快速分享照片场景。 #### 6. Siri 的增强 ...
3. Dashboard:能够显示各种小工具,比如天气、时钟、备忘录等,提高用户日常工作的便捷性。 4. Dock:Mac底部的快捷工具栏,包含常用应用程序、文件夹和系统文件,用户可以通过它快速访问常用内容。 5. Finder:...