有没有办法阻止它将所有列发送到服务器?
目前AJAX请求如下:
ssp.php?绘制= 2&列%5B0%5D%5Bdata%5D = ID&列%5B0%5D%5Bname%5D =&顺序%5B0%5D%5Bcolumn%5D = 10&顺序%5B0%5D%5Bdir%5D = ASC&开始= 0&长度= 10搜索%5Bvalue%5D =&搜索%5Bregex%5D =假&_ = 1448240832750
但它长5689个字符.我正在寻找一种方法来禁用所有不必要的列数据.这可能吗?
我正在寻找一种简单的方法来使用NSAttributedString一个非常简单的消息框类似于:
NSString *new_item = [NSString stringWithFormat:@"<span style=\"font-family: Helvetica Neue; font-size: 12.0\">%@</span>", @"MOTD HTML String downloaded from website"];
NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[new_item dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"MOTD"
message:attrStr
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
Run Code Online (Sandbox Code Playgroud)
我上面的代码采用从服务器下载的HTML格式的字符串,确保文本大小适合屏幕,然后尝试发送NSAttributedString到UIAlertView.但UIAlertView不喜欢这个.这个问题最简单的方法是什么?(非HTML格式的MOTD不是一个选项)
我收到错误:
-[__NSCFType lineBreakMode]: unrecognized selector sent to instance
Run Code Online (Sandbox Code Playgroud)
当以下代码完成执行时:
NSDictionary* options = @{ NSTextSizeMultiplierDocumentOption: [NSNumber numberWithFloat: 1.0],
DTDefaultFontFamily: @"Helvetica Neue",
};
NSAttributedString *attrStr = [[NSAttributedString alloc] initWithHTMLData:[@"HTML TEXT HERE" dataUsingEncoding:NSUTF8StringEncoding] options:options documentAttributes:NULL];
attrStr = [attrStr copy];
UILabel *lbl = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
lbl.attributedText = attrStr;
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"MOTD"
message:@""
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert setValue:lbl forKey:@"accessoryView"];
[self Load_list_Data];
[alert show];
Run Code Online (Sandbox Code Playgroud)
我的项目针对的是iOS 8+.
有任何想法吗?