- 博客(180)
- 资源 (2)
- 收藏
- 关注
原创 iOS UIlable根据内容多行显示
textLabel.lineBreakMode = NSLineBreakByWordWrapping;textLabel.numberOfLines = 0;iOS
2014-07-21 22:28:36
1193
原创 iOS Code Sign error: Provisioning profile can't be found 解决方案
出现error的过程:在运行另外一个xcode项目重置了code sign,回到原来的项目的时候出现这个error修复方法:targe-build settings-code signing identity-choose iOS Developer然后Provision File选择对应的file参考链接:https://developer.apple.com/leg
2014-07-21 17:44:32
1240
原创 iOS 修改toolbar里面文字的字体和大小
使用NSDictionaty来设置文本的属性:NSDictionary * attributes = @{NSFontAttributeName: [UIFont fontWithName:@"Heiti SC" size:20]}; [confirmBarButton setTitleTextAttributes:attributes forState:UIControlStateN
2014-07-18 21:43:56
2308
原创 iOS 去掉导航栏的边界黑线&去掉搜索框的边界黑线和其中文本输入框的阴影 - 解决方案
去掉导航栏的边界黑线in viewDidload: [self.navigationController.navigationBar setBackgroundImage:[[UIImage alloc] init] forBarMetrics:UIBarMetricsDefault]; self.navigationController.navigationBar.shad
2014-07-11 21:54:46
3839
原创 iOS 根据文本内容为TextView动态定义高度
解决方案:1.定义一个textview,在storyboard中设定constraints。2.将高度的constraint定义到头文件中:(直接拖拽)@property (weak, nonatomic) IBOutlet NSLayoutConstraint *textviewHeightConstraint;3.待在实现文件中为textview加载了内容之后,获取文本高度,为
2014-07-10 00:09:04
2671
原创 iOS 为导航栏自定义按钮图案Button Image 运行出来的颜色与原本颜色不一样 -解决方案
为相机制作闪光灯,在导航栏自定义了“闪光”图案,希望点击时变换图片,但是一直没有改变,原来是因为设置了Global Tint的颜色,所以系统会自动把图片的颜色改为Global Tint的颜色。解决方案,设置图片时,添加:imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal源码:/* ====================
2014-07-08 16:10:34
3673
翻译 iOS 运行时ScrollView上出现空白空间-解决方案
iOS7 中的UIViewControllers设置了automaticallyAdjustsScrollViewInsets。如果是YES,scrollview会根据status bar, navigation bar以及tool bar或者tab bar的高度自动调整。可以通过在storyboard的右侧进行设置,在Attributes Inspector中,不勾选“Adjust Scroll
2014-07-03 17:31:41
4912
原创 iOS 追踪限制textfield输入位数
实现效果:强制用户只能输入16位数,这里是运用在信用卡号码的输入。输入字符数大于16,把字的颜色设为黑色,且不管继续输入什么内容,只取前16位;若小于16位,把字的颜色设为红色,且设置“无效”。
2014-07-03 15:29:20
1471
转载 iOS double类型的数据设置小数点后保留两位
[NSString stringWithFormat: @"%.2lf", total]效果:
2014-07-02 23:26:27
17110
原创 iOS 搜索框search bar开始搜索
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {// things to be done regarding the textNSSting *text = seachBar.text;}
2014-06-20 23:17:03
1237
转载 iOS Xcode中设置 横屏,竖屏
方法一:程序中控制,每一个自定义的 UIViewController 都有一个方法:[html] view plaincopyprint?- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{ //看下
2014-06-19 16:51:05
7894
转载 Ruby on Rails 临时文件类Tempfile Class
A utility class for managing temporary files. When you create a Tempfile object, it will create a temporary file with a unique filename. A Tempfile objects behaves just like a File object, and you
2014-06-13 17:16:29
2960
转载 Ruby on Rails 使用Sidekiq实现多现场后台操作
资源:SidekiqSidekiq WikiSidekiq on GitHubCelluloidEpisode 271: ResqueEpisode 365: Thread-Safety (pro)terminalbrew install redisredis-server /usr/local/etc/redis.confbundle exec sidekiq
2014-06-12 00:14:11
2240
原创 iOS 现阶段(iOS 6+)如果获得iOS设备的ID
According to official documents: "uniqueIdentifier: An alphanumeric string unique to each device based on various hardware details. (read-only) (Available in iOS 2.0 through iOS 6.1. Usetheidentif
2014-06-10 17:10:29
713
原创 iOS 向服务器POST参数
- (IBAction)sendPhoto { /* resize the image to a lower resolution */ // genarate the new size based on the original image ratio UIImage *image = _imageView.image; float actua
2014-06-10 17:05:02
1287
转载 Ruby on Rails 查看文件夹是否存在,不存在则新建路径(多重路径)
path = "/tmp/a/b/c"FileUtils.mkdir_p(path) unless File.exists?(path)
2014-05-26 21:59:01
5243
转载 Ruby on Rails 在link_to的链接中加入span的tag
'button white' do %> My span 转载自:http://stackoverflow.com/questions/7563911/adding-span-tag-in-rails-link-to
2014-05-26 18:32:18
1467
转载 Ruby on Rails 查询数据库 where 和 find 的区别
u = User.find(1) returns one User #return a Set of users. In your case its only one user. u = User.where("username = ?", "percent20") The result type is ActiveRecord::Relation --> [User, Us
2014-05-16 16:25:39
3365
转载 Ruby on Rails 关于object的方法create 和 new 的区别
From the ActiveRecord::Base documentation:create(attributes = nil) {|object| ...}Creates an object (or multiple objects) and saves it to the database, if validations pass. The resulting obje
2014-05-16 16:16:21
1625
转载 Ruby on Rails delete 和 destroy 的区别
Basically "delete" sends a query directly to the database to delete the record. In that case Rails doesn't know what attributes are in the record it is deleteing nor if there are any callbacks (such a
2014-05-16 16:08:46
2421
转载 Ruby on rails 使用image_path为图片设置打开自己的链接
"wine_pic"), image_path(@request.picture) %>
2014-05-16 16:04:49
3330
转载 Ruby on rails 点击链接,在新标签页打开页面
'new' %>转载自:http://stackoverflow.com/questions/13107229/open-a-new-page-tab-in-the-background-ruby
2014-05-16 15:59:18
1710
原创 Javascript + Ruby on Rails: 提交上传文件之前检验文件类型
HTML:" action="" method="post" enctype="multipart/form-data" onsubmit="return validateFile('')"> File: " name="file_to_upload"> " /> "hidden", :name => request_forgery_protection_toke
2014-04-29 23:00:03
1463
转载 Ruby on Rails: 给button_to添加图标
Add To Cart"), line_items_path(product_id: product), class: "btn btn-success", method: :put %>转载自:
2014-04-29 22:54:34
1322
转载 Ruby on Rails 导入CSV文件至数据库
config/application.rbrequire 'csv'view: index.html.erb
2014-04-25 23:07:50
2582
转载 Html Javascript Checkbox 全选/全不选
HTML: 全選 book1 book2 book3 book4 book5JavaScript:Demo:
2014-04-25 22:45:24
960
转载 Rails Render和Redirect_to区别
Redirect_to是跳转到一个新的action中继续执行,相当于浏览器发送了一个新的请求,并且默认返回302状态码def redirect_to(options = {}, response_status = {}) #:doc:raise ActionControllerError.new("Cannot redirect to nil!") if options.nil?
2014-04-14 18:07:42
2646
翻译 Ruby on Rails 错误“Rails 4.0.0, Gemfile requires rake 10.1.0 for Rake” 解决方案
问题:在 rake db:migrate 出现问题:Joses-MacBook-Air:crumblr JRV$ rake db:migraterake aborted!You have already activated rake 10.1.1, but your Gemfile requires rake 10.1.0. Using bundle exec may s
2014-04-10 17:39:13
1744
转载 Ruby 字符串分割示例
a = "hello there"a[1] #=> "e"a[2, 3] #=> "llo"a[2..3] #=> "ll"a[-3, 2] #=> "er"a[7..-2] #=> "her"a[-4..-2]
2014-04-10 17:32:00
6231
原创 Ruby on Rails: 错误“ActionController::InvalidAuthenticityToken when disable JS/Ajax request”解决方案
问题:在RoR项目中提交表格时出现:ActionController::InvalidAuthenticityToken when disable JS/Ajax request
2014-04-10 17:26:00
1334
大型共享数据库数据的关系模型
2012-02-18
新浪微博数据挖掘方案
2012-08-28
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅