小编use*_*951的帖子

如果我们不知道第一封信,目标C中的代码意义

好吧,只有当我们按某个字母时,目标c中的intellisense或代码感似乎才会触发.

如果我不知道对象方法的第一个字母,我更喜欢知道类支持的所有方法.

有办法吗?

intellisense xcode objective-c codesense

2
推荐指数
1
解决办法
187
查看次数

如果表为空, cellForRowAtIndexPath 应该返回什么?

 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
Run Code Online (Sandbox Code Playgroud)

我认为如果表是空的,即

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [[BNUtilitiesQuick getBizs] count];
}
Run Code Online (Sandbox Code Playgroud)

总是返回 0

我希望-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath根本不应该调用

这个很重要。我正在制作一个程序来搜索事物,有时经过一些搜索,没有返回任何结果。

但是,无论如何都被调用了,我得到了一个例外。我该怎么办?

iphone xcode objective-c uitableview ios

2
推荐指数
1
解决办法
2472
查看次数

initWithNibName究竟做了什么?

theTestController = [[[CustomCell alloc]initWithNibName:@"CustomCell" bundle:[NSBundle mainBundle]]autorelease];
Run Code Online (Sandbox Code Playgroud)

我的猜测是它将加载CustomCell并将theTestController设置为所有者.如果是这样:

  1. 为什么在cellForRowAtIndexPath我看到的大多数示例代码中[[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner: theTestController options:nil]; 代替?

  2. [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner: theTestController options:nil];和之间有什么区别theTestController = [[[CustomCell alloc]initWithNibName:@"CustomCell" bundle:[NSBundle mainBundle]]autorelease];

  3. 我试过替换[[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner: theTestController options:nil]; , theTestController = [[[CustomCell alloc]initWithNibName:@"CustomCell" bundle:[NSBundle mainBundle]]autorelease];我得到了错误.nil如果我使用后者,看起来仍然存在.

xcode objective-c uitableview

2
推荐指数
1
解决办法
2561
查看次数

将以什么顺序运行(某些NSDictionary中的NSString*ID)?

for(NSString * ID in someNSMutableDictionary) 
{
//do something
}
Run Code Online (Sandbox Code Playgroud)

现在,ID会按照添加到someNSMutableDictionary的顺序显示吗?

xcode objective-c nsmutabledictionary

2
推荐指数
1
解决办法
98
查看次数

如何知道没有NSLog的指针(xcode)的值?

在此输入图像描述

这意味着makeUrlforGetBusinessIDLocal是NSString*

我想知道它的价值.没有NSLog

我怎么知道这个价值?值为http:// isi ............

如果我右键单击并选择编辑值,我只能看到"0x754cf40"

我们知道"0x754cf40"是内存地址.我不想知道它,但是那个内存地址的价值.我怎样才能做到这一点?

没有NSLog我可以这样做吗?

iphone xcode nslog nsstring

2
推荐指数
1
解决办法
2114
查看次数

这个宏有什么问题?

#define mySynthesize(op) @synthesize op = _op;
Run Code Online (Sandbox Code Playgroud)

所以而不是打字

@synthesize someVar=_someVar;
@synthesize otherVar=_otherVar;
Run Code Online (Sandbox Code Playgroud)

我可以做

mySynthesize (someVar);
Run Code Online (Sandbox Code Playgroud)

嗯,它不起作用.我做错了什么?

macros xcode objective-c

2
推荐指数
1
解决办法
110
查看次数

po [NSThread currentThread]

当我做po [NSThread currentThread]时,我得到了

{name =(null),num = 4}

当我向左看时,我看到: 在此输入图像描述

看起来它是线程号6,而不是4.还有什么属性我们需要调用来获取该线程数?

[NSThread currentThread] .number?虽然不存在.

xcode objective-c nsthread

2
推荐指数
1
解决办法
6465
查看次数


如何隐藏我们自己的应用程序

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    [[NSWorkspace sharedWorkspace] hideOtherApplications];// Insert code here to initialize your application

}
Run Code Online (Sandbox Code Playgroud)

这会隐藏其他应用程序.我们还应该怎样做才能隐藏自己的主窗口?

cocoa

2
推荐指数
1
解决办法
908
查看次数

我如何知道哪个文件已打开ARC以及哪个文件已关闭ARC?

ARC代表自动参考计数.

我刚刚升级了我的项目以使用ARC.不是全部.一些.

我怎么知道?

xcode automatic-ref-counting

2
推荐指数
1
解决办法
839
查看次数