- 浏览: 52065 次
文章列表
iOS与server交互
- 博客分类:
- iOS
- (NSString *)loginConnection {
NSString* returnValue = @"";
//准备url
NSString *host = [GlobalData getHostUrl];
NSString *urlstr = [host stringByAppendingString:@"login.json"];
NSURL *url = [NSURL URLWithString:urlstr];
//准备数据
NSData *postData = ...
//在Login Lable上添加spinner
UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
[spinner startAnimating];
spinner.center = self.loginButton.center;
[self.view addSubview:spinner];
//多线程等待logi ...
//加载NavigationBar的背景图片
UINavigationController *navController = [self navigationController];
UINavigationBar *navBar = [navController navigationBar];
CGSize navSize = CGSizeMake(navBar.frame.size.width, navBar.frame.size.height);
UIImage *scaledImage = [self scaleToSize:[UIIma ...
[self performSegueWithIdentifier:@“AskAboutSnowboard” sender:self];
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:@“DoAParticularThing”]) {
[segue.destinationViewController performSelector:@selector(setPreviousImages:) ...
delegate和Protocol
- 博客分类:
- iOS
Protocol 类似接口(interface), 但是由其他类实现
//定义Protocol
@protocol UIScrollViewDelegate
@optional
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)sender;
- (void)scrollViewDidEndDragging:(UIScrollView *)sender willDecelerate:(BOOL)decelerate;
@end
//在自己的类接口中声明
@interface UIScrollView ...
[iOS开发] TableView
- 博客分类:
- iOS
Dynamic TableView的使用方法
1 设置TableView的delegate和dataSource(TableView has two important @propertys: its delegate and its dataSource. )
2 声明实现这两个Delegate <UITableViewDelegate, UITableViewDataSource>
3 UITableView dataSource protocol必须实现3个方法
1) section的数目
2)section中row的数目
3)cell的具体内容
...
http://brainbowapps.com/articles/2010/uploading-files-from-iphone-to-rails.html
Ruby 的标准 open-uri库仅支持get请求
NET::HTTP 可以提供其他的方法
XML解析器
ruby自带的标准xml解析器-REXML 具有一定严格性,能够拒绝一定的有错格式的xml,但不会严格到拒绝所有格式有错的xml
如果只想接受良构的xml,得用libxml2
如果希望处理有错得xml,最佳选择是 hpricot
不顺利的时候:
1 忘记deadline,静下心,一行一行代码,一行一行文字,仔细阅读
2 分解成最最细小的任务,一步一步完成
Reason for file uploading problem with jQuery Mobile is that by default, form submits data using ajax. With Ajax, file input data is not submitted, and solution is very simple, just disable the ajax for forms submissions.
原文解决方法:
http://www.parorrey.com/blog/jquery-mobile/file-input-field-upl ...
#lib/tasks/import.rake
------------------------------------------------------------------
# encoding: utf-8 ///magic encoding 该注释可读取utf-8
require 'csv'
desc "Import data from csv file"
task :import => [:environment] do
CSV.foreach("db/mappingdata.csv") do ...
Crontab 使用:
https://help.ubuntu.com/community/CronHowto
Test Rails route in console:
inclue ActionController:UrlWriter
If...elsif... 若if中匹配了,则执行if中语句,否则进入elsif
Time类中的+,-等运算符,精确到秒,不能进行微妙级别的运算
a = Time.at(02).utc # => 1970-01-01 00:00:20 UTC
b = a + 2 # => 1970-01-01 00:41:42 UTC
a = Time.at(02,500).utc # => 1970-01-01 00:00:20 UTC
b = a + 2500 # => 1970-01-01 00:41:42 UTC
puts "a" if ...
方法一:
config.action_mailer.raise_delivery_errors = true
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => 'gmail.com',
:user_name => "username& ...
mysql gem 安装
系统:OS X 10.6.8
Ruby:1.8.7
rails:2.3.x
bundle install 出现
Building native extensions. This could take a while...ERROR: Error installing mysql2.8.1: ERROR: Failed to build gem native extension.