大多数时候,我的图像选择器工作得很好(iOS 4.2.1).但是,如果我通过大约300张照片的相机卷上下快速地上下滚动4-6次,我就会崩溃.这种情况从未发生在同一iPhone 3G上的"照片"应用程序中.此外,我注意到股票"照片"应用程序滚动比我的图像选择器更顺畅.
有没有人注意到这种行为?如果其他人可以在他们自己的应用程序中尝试这个并看看他们是否崩溃,我会感兴趣.我不认为它与其他对象占用我的iPhone上的内存有关,因为它是一个简单的应用程序,这发生在我启动应用程序后.根据我的崩溃日志以及模拟器对模拟内存警告响应良好这一事实,它似乎与发送到其他已发布对象的消息或viewdidunload中其他对象的过度释放无关.我认为这可能是UIImagePickerController内部实现中的一个错误......
这就是我启动选择器的方式.我已经完成了多种方式(包括在我的标题中为UIImagePickerController设置retain属性并在dealloc上释放).这似乎是最好的方法(崩溃最少):
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
picker.allowsEditing = YES;
[self presentModalViewController:picker animated:YES];
[picker release];
Run Code Online (Sandbox Code Playgroud)
这是崩溃的线程(我得到各种异常类型):
Exception Type: SIGSEGV
Exception Codes: SEGV_ACCERR at 0xfffffffff4faafa4
Crashed Thread: 8
...
Thread 8 Crashed:
0 CoreFoundation 0x000494ea -[__NSArrayM replaceObjectAtIndex:withObject:] + 98
1 PhotoLibrary 0x00008e0f -[PLImageTable _segmentAtIndex:] + 527
2 PhotoLibrary 0x00008a21 -[PLImageTable _mappedImageDataAtIndex:] + 221
3 PhotoLibrary 0x0000893f -[PLImageTable dataForEntryAtIndex:] + 15
4 PhotoLibrary 0x000087e7 PLThumbnailManagerImageDataAtIndex + 35
5 PhotoLibrary 0x00008413 -[PLThumbnailManager _dataForPhoto:format:width:height:bytesPerRow:dataWidth:dataHeight:imageDataOffset:imageDataFormat:preheat:] …
Run Code Online (Sandbox Code Playgroud) 我有一个 System.Windows.Forms DataGridView 绑定到List<MyObject>
.
MyObject 类包含绑定到 DataGridView 中的 DataGridViewCheckboxCell 的布尔属性。
public class MyObject
{
public decimal DefaultValue {get; set; }
public bool HasCustomValue {get;set; }
public decimal CustomValue {get;set; }
public decimal CurrentValue
{
get
{
return HasCustomValue
? CustomValue
: DefaultValue;
}
}
Run Code Online (Sandbox Code Playgroud)
如果我更改HasCustomValue
另一个(只读)属性CurrentValue
的值也会更改它的值。这是通过实现 INotifyPropertyChanged 事件来完成的(为了简单起见,我将该部分留在了源示例中)
如果我HasCustomValue
从 DataGridView 外部更改,绑定到的列CurrentValue
会立即更新。但是,如果用户启用/禁用复选框,HasCustomValue
则不会在基础数据源中更改,除非他通过单击鼠标或按 TAB 键离开该列。
有没有办法在更改复选框值后强制网格直接更新数据源?
如果我绑定了一个控件属性,我可以设置为DataSourceUpdateMode
,Windows.Forms.DataSourceUpdateMode.OnPropertyChanged
但我在 DataGridView 中没有找到类似的东西
如何在stringWithFormat函数中添加百分比?例如,我想要以下内容:
float someFloat = 40.233f;
NSString *str = [NSString stringWithFormat:@"%.02f%",someFloat];
Run Code Online (Sandbox Code Playgroud)
这应该导致字符串:
40.23%
Run Code Online (Sandbox Code Playgroud)
但事实并非如此.我怎样才能做到这一点?
以下代码段适用于我:
class Foo {
public:
template <class T> T& get () { ... }
};
Foo foo;
foo.get<int>() = ...;
Run Code Online (Sandbox Code Playgroud)
但是,以下代码段对我不起作用:
class Foo {
public:
template <class T> T& operator() () { ... }
};
Foo foo;
foo<int>() = ...;
Run Code Online (Sandbox Code Playgroud)
错误是:
expected primary-expression before '>' token
expected primary expression before ')' token
Run Code Online (Sandbox Code Playgroud)
这两个错误都指的是 foo<int>()
为什么这不起作用,是否可以解决这个问题?
我想复制目录中的所有文件,但特定子目录中的某些文件除外.我注意到'cp'命令没有--exclude选项.那么,我怎样才能做到这一点?
我正在尝试从IntelliJ Idea运行一个小型的OSGi项目.我在Idea的OSGi配置部分添加了Equinox容器.然后我将OSGi方面添加到项目中.到目前为止,一切看起来都不错.
但是,一旦我尝试运行该项目,我就会遇到麻烦.我使用IntelliJ Idea的'OSGi Bundles'跑步者.在那里,我选择我的项目包和OSGi容器并运行它.这个问题开始了.我总是出现同样的错误信息:
___
/ /
/ / Oops, there has been a problem!
/ /
/__/ Platform [platform.felix 3.0.6] is not supported
___
/__/
-> Exception caught during execution:
org.ops4j.pax.runner.ConfigurationException: Platform [platform.felix 3.0.6] is not supported
at org.ops4j.pax.runner.Run.installPlatform(Run.java:611)
at org.ops4j.pax.runner.Run.start(Run.java:221)
at org.ops4j.pax.runner.Run.main(Run.java:148)
at org.ops4j.pax.runner.Run.main(Run.java:121)
Run Code Online (Sandbox Code Playgroud)
我试图使用其他OSGi容器,如Felix或Knopflerfish,并遇到同样的问题.有谁知道我做错了什么.或者IntelliJ支持哪些版本的OSGi容器?
我想得到第一个2字符串彼此不同的地方.示例:对于这两个字符串:"AAAB""AAAAC"
我想得到结果4.
我如何在C#中做到这一点?
这是与其他一些类似的重复,但我认为我event.preventDefault()
在这种情况下使用正确.
这是一个JSFiddle,你可以看到代码:http://jsfiddle.net/SeEw2/2/
基本上,单击"提交"按钮.
在Chrome中:没有任何反应 - 正确的回应.
在Firefox中:页面重新加载,哦,不!
那么为什么页面在Firefox而不是Chrome中重新加载?我一直在Firebugging它并没有出现任何错误......
我正在玩IF EXIST批处理文件命令,但遇到了一个场景.我想做的是
IF EXIST C:\ Windows\system32调用batchfile2
IF EXIST C:\ WINNT\system32调用batchfile3
但是有些情况下,如果win2k升级到XP而不是全新的XP安装,那么这两个目录都存在于PC上.如果它检测到两个目录,我想要它做什么是"什么都不做",因为上面的前两个选项已经处理了我想要做的事情.有人能告诉我如何操纵这个吗?
除了上面的内容之外,我相信我也可以在同一个批处理中调用子程序,但是如果它检测到"Windows\system32"和"WINNT\system32",我怎么能创建一个子程序来结束脚本呢?
如果EXISTS C:\ Windows\system32转到sub1,则转到sub2
:SUB1
:SUB2
提前谢谢了.