我有Person模型,它包含id,first_name,last_name等和merital_id字段.我也有Merital模型只包含2个字段:id和title.服务器响应JSON如:
{
success: true,
items: [
{
"id":"17",
"last_name":"Smith",
"first_name":"John",
...
"marital_id":1,
"marital": {
"id":1,
"title":"Female"
}
},
...
]
}
Run Code Online (Sandbox Code Playgroud)
那么如何将我的模型与关联联系起来呢?我仍然可以在我的column.renderer中使用record.raw.merital.title,但我不能在像{last_name} {first_name}({merital.title})这样的模板中使用这些字段.我需要使用什么样的关联王,我尝试使用belongsTo,但是当我尝试使用record.getMarital()时,我得到一个错误"记录中没有这样的方法".
我使用extjs 4
我刚刚开始为Mac OS X编写代码,我对标签控件非常兴奋,就像这样:

但我无法理解如何实现它.是否有标准的UIKit控件或一些外部控件,或者这只是一组按钮?
我有一些循环.在这个循环中,我提出了一些请求并获得了响应文本.在循环结束时,由于某种原因我睡眠线程几秒钟并继续迭代.[Vk朋友]中有大约500个对象,因此重复大约500次,但是当它完成我的程序时,使用的内存比启动时多得多.我使用ARC,我不明白为什么循环中分配的内存不会在每次迭代时释放?这是正常的,还是我错了?
for (Friend *friend in [Vk friends]) {
[[NSNotificationCenter defaultCenter] postNotificationName:@"log" object:[NSString stringWithFormat:@"Visit %i/%i friend (earn %i coins)", ++count, [Vk friends].count, [UserState coins] - coinsBefore]];
if (friend.helpPoints <= 0) continue;
strData = [NSString stringWithFormat:@"someparams=somevalues¶m1=%@", [Vk authKey]];
data = [strData dataUsingEncoding:NSUTF8StringEncoding];
request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://someaddress/somepath?somegetparams=%@", [Vk userId]]]];
request.HTTPMethod = @"POST";
[request setValue:[NSString stringWithFormat:@"%i", [data length]] forHTTPHeaderField:@"Content-Length"];
[request setValue:@"User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.43 Safari/536.11" forHTTPHeaderField:@"User-Agent"];
[request setValue:@"http://blahblah.com" forHTTPHeaderField:@"Origin"];
[request setValue:@"http://blahblah.com" forHTTPHeaderField:@"Referer"];
[request …Run Code Online (Sandbox Code Playgroud) cocoa ×2
macos ×2
appkit ×1
associations ×1
extjs ×1
for-loop ×1
javascript ×1
model ×1
objective-c ×1