A界面中有个UIScrollView push到下一个界面,在返回时UIScrollView的contentoffset自动改变!
那么只用在viewDidLoad中添加:
self.automaticallyAdjustsScrollViewInsets = NO;
有时候需要弹出一个控件,但是在viewDidLoad中写没用,那么可以在下面方法中使用
- (void)viewDidAppear:(BOOL)animated;
iOS国际化遇到问题: the data couldn't be read because it isn't in the correct format.
"home" : "နေအိမ်",错误"home" = "နေအိမ်"; 正确 (=) 和后面的(;)分号是必须要的
swift
因为后台是.net 所以请求参数需要json 但是Alamofire 的方法必须是字典!!!!所以就要设置head
var parameters = [String : AnyObject]()
parameters["UserName"] = "admin" as AnyObject
parameters["UserPwd"] = "mdb123" as AnyObject
let parJson = getJSONStringFromDictionary(dictionary: parameters as NSDictionary)
let headers: HTTPHeaders = [ "Accept": "application/json" ]
Alamofire.request(baseUrls, method: .post, parameters: parameters, encoding: JSONEncoding.default, headers: headers).responseJSON { (response) in print("jsonRequest:\(response.result)") if let JSON = response.result.value { print("JSON: \(JSON)") } }
这样就ok