我得到的UITutView属于UIButton属于这样:
-(void)buttonHandler:(UIButton *)button {
OrderCell *cell = [[button superview] superview];
NSLog(@"cell.item = %@", cell.item.text);
Run Code Online (Sandbox Code Playgroud)
在iOS 7之前它可以正常工作.但是给了我:
[UITableViewCellScrollView item]:无法识别的选择器发送到实例0x17ae2cf0
如果我在iOS 7中运行该应用程序.但如果我这样做:
-(void)buttonHandler:(UIButton *)button {
OrderCell *cell = [[[button superview] superview] superview];
NSLog(@"cell.item = %@", cell.item.text);
Run Code Online (Sandbox Code Playgroud)
然后它可以在iOS 7中运行,但不是更早???!?!
我这样做是在绕过这个问题:
OrderCell *cell;
if([[[UIDevice currentDevice] systemVersion] isEqualToString:@"7.0"])
cell = [[[button superview] superview] superview];
else
cell = [[button superview] superview];
NSLog(@"cell.item = %@", cell.item.text);
Run Code Online (Sandbox Code Playgroud)
但是WTF还在继续!?有谁知道为什么会这样?
谢谢!
我创建一个RadioGroup
与RadioButton
小号动态的,需要有一个单选按钮默认为选中.
我通过使用radioButton.setChecked(true)
和完成了这个radioButton.toggle();
我遇到的问题是,当我在运行时选择另一个单选按钮时,第一个单选按钮保持选中状态,因此我最终在收音机组中有两个选中的单选按钮.
有谁有这个问题,知道如何解决它?
private RadioButton addRadioButton(String type, String price){
RadioButton radio = new RadioButton(Order.this);
radio.setText(type + " (" + Utils.formatCurrency(price) + ")");
radio.setTextAppearance(Order.this, R.style.portalCellTextStyle);
radio.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);
radio.setTag(price);
if(type.toLowerCase().equals("m"))
radio.toggle();
return radio;
}
Run Code Online (Sandbox Code Playgroud) 我已经创建了一个在localhost上工作正常的简单网站.所以我把它放在IIS Windows 2008r2服务器上,现在我的PHP脚本不再写入我的JSON文件了.我检查了服务器并安装了PHP,所以我真的不知道什么是错的或者在哪里看.
我还没有开始工作,所以我想更详细地解释一下情况.
因此,此脚本适用于localhost,但不适用于IIS服务器.
<?php
$myFile = "../json/countries.json";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = json_encode($_POST["data"]);
fwrite($fh, $stringData);
fclose($fh)
?>
Run Code Online (Sandbox Code Playgroud)
我试过添加:
error_reporting(E_ALL);
ini_set('display_errors', '1');
Run Code Online (Sandbox Code Playgroud)
和
chmod("../json/countries.json", 0644);
Run Code Online (Sandbox Code Playgroud)
到PHP但没有看到任何不同的结果或任何错误.
这是启动进程的javascript函数,将对象输出到控制台确实显示了要保存的正确数据.
function saveJson(object, file) {
console.log("Saving JSON data: " + JSON.stringify(object));
$.ajax
({
type: "POST",
dataType : 'json',
async: false,
url: file,
data: { data:object },
success: function () {console.log("Thanks!"); },
failure: function() {console.log("Error!");}
});
Run Code Online (Sandbox Code Playgroud)
}
仍然没有更改json文件.任何善于使用Windows Server和php的人都知道为什么?
谢谢