之间有什么区别:
@objc class MyClass: NSObject{}
Run Code Online (Sandbox Code Playgroud)
和
@objc(MyClass)
class MyClass: NSObject{}
Run Code Online (Sandbox Code Playgroud) 有一个UITableView关于我的看法,我想申请一个特定部分的触击删除模式的行.我实施的内容如下:
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@">> canEditRowAtIndexPath");
if (indexPath.section == CanDeletedSection) {
return YES;
}else{
return NO;
}
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@">> editingStyleForRowAtIndexPath");
if (indexPath.section == CanDeletedSection) {
return UITableViewCellEditingStyleDelete;
}
return UITableViewCellEditingStyleNone;
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@">> commitEditingStyle");
if (editingStyle == UITableViewCellEditingStyleDelete) {
// dosomething
}
}
Run Code Online (Sandbox Code Playgroud)
但是当我滑动表格行时,有时Delete按钮会出现,有时则不会.顺便说一句,我的单元格是自定义的并且继承自UITableViewCell.
我已经添加了NSLog上述方法.当Delete按钮没有出现时,我得到的日志如下:
>> editingStyleForRowAtIndexPath
>> canEditRowAtIndexPath
Run Code Online (Sandbox Code Playgroud)
出现Delete按钮时,日志如下:
>> editingStyleForRowAtIndexPath
>> …Run Code Online (Sandbox Code Playgroud) 我发送一个GET请求到这个URL: https://test.com/app/login?json={"user":"test@gmail.com","password":"test"}
但是返回此错误:
Error Domain=AFNetworkingErrorDomain Code=-1016 "Request failed: unacceptable content-type: text/plain" UserInfo=0x9ad3520 {NSErrorFailingURLKey=https://test.com/app/login?json=%7B%22user%22:%22test@gmail.com%22,%22password%22:%22test%22%7D, AFNetworkingOperationFailingURLResponseErrorKey= { URL: https://test.com/app/login?json=%7B%22user%22:%22test@gmail.com%22,%22password%22:%22test%22%7D } { status code: 200,
headers {
"Cache-Control" = "max-age=900";
Connection = "Keep-Alive";
"Content-Length" = 6116;
"Content-Type" = "text/plain; charset=UTF-8";
Date = "Wed, 15 Jan 2014 09:14:22 GMT";
Expires = "Wed, 15 Jan 2014 09:29:22 GMT";
"Keep-Alive" = "timeout=2, max=100";
Server = "Apache-Coyote/1.1";
"Set-Cookie" = "APP-SESSION-ID=xxxxxxxxxxxxxxxx; Path=/app/; HttpOnly, APP-ROUTE-ID=.app1_node2; path=/, API-ROUTE-ID=.app1_node2; path=/";
} }
, NSLocalizedDescription=Request failed: unacceptable content-type: text/plain}
Run Code Online (Sandbox Code Playgroud)
这是我的代码,我使用NSUTF8StringEncoding添加了百分比转义.
manager = …Run Code Online (Sandbox Code Playgroud)