我有以下对象结构:
它曾经工作,但后来我将UITabBarController添加到混合中,并进行了一系列其他大的更改,并在它之间停止了.
到目前为止,我有:
可能有用的一件事-scrollViewShouldScrollToTop:是即使表视图控制器tableView.delegate设置为控制器,也不会被调用.
这是一个很长的镜头,但是有没有人知道在使用接近传感器(UIDevice.proximityMonitoringEnabled和proximityState)时避免自动屏幕消隐的方法?
文件说:
UIInterfaceOrientationLandscapeLeft设备处于横向模式,设备直立,主页按钮位于右侧.
UIInterfaceOrientationLandscapeRight设备处于横向模式,设备直立,主页按钮位于左侧.
但是,我让他们完全颠倒了.SDK中真的会出现这样的错误,还是我只是疯了?
码:
+ (NSString *)NSStringFromUIInterfaceOrientation:(UIInterfaceOrientation)o
{
switch (o) {
case UIInterfaceOrientationPortrait: return @"UIInterfaceOrientationPortrait";
case UIInterfaceOrientationPortraitUpsideDown: return @"UIInterfaceOrientationPortraitUpsideDown";
case UIInterfaceOrientationLandscapeLeft: return @"UIInterfaceOrientationLandscapeLeft";
case UIInterfaceOrientationLandscapeRight: return @"UIInterfaceOrientationLandscapeRight";
}
return nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
NSLog(@"Should: %@", [[self class] NSStringFromUIInterfaceOrientation:toInterfaceOrientation]);
return YES;
}
Run Code Online (Sandbox Code Playgroud)
我将上面的代码粘贴到默认的基于导航的应用程序模板的RootViewController.m中.
后续行动:报告为错误7216046.
我想提示用户从他们的地址簿中选择一个或多个人,但ABPeoplePickerNavigationController不允许这样做(具有讽刺意味的是,因为它是人物选择器,而不是人员选择器).
在我创建自己的之前,有没有人知道这种控制器的替代(开源)实现?
我使用pipe(),fork(),dup(),execve()生成子进程.
从父级,是否可以安全地等待子级的stdin和stdout关闭(即read()返回0),然后执行waitpid()来收集终止状态?
或者,如果没有关闭stdin和stdout,进程会失败吗?(因此我的程序永远不会得到waitpid)
为了澄清,我问以下是否安全:
while (child_stdin != -1 && child_stdout != -1) {
poll(...)
if (got_stdout) {
n = read(child_stdout);
if (n >= 0) {
// do something with output
} else if (n == 0) {
child_stdout = -1
}
}
// same for stdin
}
waitpid(child_pid)
Run Code Online (Sandbox Code Playgroud)
或者可能会发生孩子终止,但我永远不会在read()或write()上得到0.
没有信号,只有poll() - ing.
因此NULL,它通常用于指针,并且nil用于对象指针.
现在我也看到了Nil,它也被更低级的Obj-C运行时函数所使用class_getProperty.
这在某种程度上与nil哲学不同吗?(是的,我知道他们实际上都是0)
它为什么甚至被引入?或者,如果Nil是第一个(很可能),为什么会被nil引入?