描述有点简洁.我只是在我的本地主分支上添加了一个文件并将其推回到远程仓库.知道为什么会这样吗?
warning: updating the current branch warning: Updating the currently checked out branch may cause confusion, warning: as the index and work tree do not reflect changes that are in HEAD. warning: As a result, you may see the changes you just pushed into it warning: reverted when you run 'git diff' over there, and you may want warning: to run 'git reset --hard' before starting to work to recover. warning: warning: You can set 'receive.denyCurrentBranch' configuration variable to warning: …
这个概念似乎给我带来了麻烦.为什么NSError对象需要将其指针传递给正在修改对象的方法?例如,不仅仅是传递对错误的引用做同样的事情吗?
NSError *anError;
[myObjc doStuff:withAnotherObj error:error];
Run Code Online (Sandbox Code Playgroud)
然后在doStuff中:
- (void)doStuff:(id)withAnotherObjc error:(NSError *)error
{
// something went bad!
[error doSomethingToTheObject];
}
Run Code Online (Sandbox Code Playgroud)
为什么上述工作不像大多数其他对象消息传递模式一样有效?为什么必须使用错误:(NSError**)错误?
我一直在寻找一些具体的场景,NSOperation以确定iPhone 何时是应用程序中使用的理想工具.据我所知,这是编写自己的threaded代码的包装器.我还没有看到任何使用它的Apple演示应用程序,我想知道我是否错过了一个很棒的工具而不是使用它NSThread.
这里的理想解决方案是描述用例场景NSOperation以及如何使用它来解决您的问题.
我正在看一些应该是微不足道的代码 - 但我的数学在这里惨遭失败.
这是一个条件,使用以下内容检查数字是否为2的幂:
if((num != 1) && (num & (num - 1))) { /* make num pow of 2 */ }
Run Code Online (Sandbox Code Playgroud)
我的问题是,如何在num和num-1之间使用按位AND来确定数字是2的幂?
我正在尝试使用UIButton获取UIDatePicker以显示在UIActionSheet中.不幸的是,它被裁掉了,整个日期选择器都不可见.我还没有尝试过添加UIButton.任何人都可以建议让整个视图适合吗?我不确定如何添加适当的尺寸,因为UIActionSheet似乎缺少-initWithFrame:类型构造函数.
UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:@"Date Picker"
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:nil];
// Add the picker
UIDatePicker *pickerView = [[UIDatePicker alloc] init];
pickerView.datePickerMode = UIDatePickerModeDate;
[menu addSubview:pickerView];
[menu showInView:self.view];
[pickerView release];
[menu release];
Run Code Online (Sandbox Code Playgroud)
我也尝试过类似的东西:
UIActionSheet *menu = [[UIActionSheet alloc] initWithFrame:CGRectMake(200.0, 200.0, 100.0f, 100.0f)];
Run Code Online (Sandbox Code Playgroud)
这些坐标是不现实的,但它们似乎不会影响UIActionSheet的位置/大小.
例如,我知道0x46767f0属于NSString*,有什么方法可以找出NSString是什么来帮助我找到一些我想要的错误?
任何人都可以解释Objective-C中协议和类别之间的差异吗?你什么时候用另一个?
我试图找到一个objective-c对象的大小.我正在使用类似的东西:
NSLog(@"sizeof myObject: %ld", sizeof(*myObject));
Run Code Online (Sandbox Code Playgroud)
这只是给了我指针的大小.
我究竟做错了什么?
git log origin/master
git log origin/master..
Run Code Online (Sandbox Code Playgroud)
与上面的确切区别是什么?我试图理解..符号的确切含义.我认为这是一个范围,但在这种情况下,它做了一些不同的事情.
我一直在看到一些类似于以下内容的代码:
@protocol MyProtocol <NSObject>
// write some methods.
@end
Run Code Online (Sandbox Code Playgroud)
MyProtocol符合NSObject协议有什么特别的原因吗?如果你做的事情如下:
id <MyProtocol> foo; // foo here conforms to NSObject AND MyProtocol?
Run Code Online (Sandbox Code Playgroud)
只是好奇逻辑是什么.
objective-c ×6
c ×3
iphone ×3
cocoa ×2
cocoa-touch ×2
git ×2
debugging ×1
gdb ×1
math ×1
memory ×1
nsoperation ×1
pointers ×1
sizeof ×1
uidatepicker ×1