当我慢慢下拉刷新时,我看到UIActivityIndicator圈在开始刷新之前慢慢变得更加完整.在圆圈完成并且刷新实际触发之前,内容跳跃/猛然下降然后圆圈开始旋转.我慢慢拉下来时才会注意到这一点.
我正在使用pull来刷新名为mainSV的滚动视图
self.refresh = [[UIRefreshControl alloc] init];
[self.refresh addTarget:self action:@selector(handleRefresh) forControlEvents:UIControlEventValueChanged];
[self.mainSV addSubview:self.refresh];
Run Code Online (Sandbox Code Playgroud)
为什么会发生这种跳跃/混蛋?
我有以下C#代码:
string stg1 = "String 1";
string stg2 = "String 2";
string stg3 = "String 3";
string stg4;
stg4 = stg1 + stg3;
stg4 = stg4 + stg2 + stg3;
stg4 = "";
stg3 = "";
Run Code Online (Sandbox Code Playgroud)
创建了多少个字符串对象?
我想创建7个字符串对象:"String 1","String 2","String 3",stg1 + stg3,stg4 + stg2 + stg3,"",和"".我不确定第4个statement(string stg4;)是否创建了一个字符串对象,并且我在某处读取了一个字符串,空字符串""不会创建一个对象,但我不认为这是真的.你们有什么感想?
我有一个字符串可能包含短代码,例如"这是一个带[anyshortcode1]的字符串,这是[anyshortcode2]".我想显示字符串,其中包含运行放置位置的短代码.当我回显这个字符串时,它不会执行短代码,只是将它们打印出来,将它们留在括号中.我试图通过使用如下代码来解决这个问题:
$string_with_shortcodes = "this is a string with [anyshortcode1] and this is [anyshortcode2]";
$pattern = get_shortcode_regex();
preg_match_all("/$pattern/",$string_with_shortcodes, $matches);
foreach ($matches[0] as $short) {
$string_with_shortcodes = str_replace($short, 'do_shortcode("' . $short . '")', $string_with_shortcodes);
}
eval("\$string_with_shortcodes = \"$string_with_shortcodes\";");
echo $string_with_shortcodes;
Run Code Online (Sandbox Code Playgroud)
这会成功执行字符串替换,但会导致eval函数出错:
解析错误:语法错误,意外T_STRING
我使用eval函数错了吗?或者是否有更简单的方法来完成从字符串运行短代码?