小编Abi*_*ern的帖子

我不知道如何在iOS 6中进行纵向和颠倒

我在用:

- (NSUInteger)supportedInterfaceOrientations {

    return UIInterfaceOrientationMaskPortrait; 

}
Run Code Online (Sandbox Code Playgroud)

如何在iOS6中将它用于纵向和颠倒?

这适用于景观左 UIInterfaceOrientationMaskLandscapeLeft

这对于风景吧 UIInterfaceOrientationMaskLandscapeRight

这适用于两种景观 UIInterfaceOrientationMaskLandscape

iphone xcode objective-c uiinterfaceorientation ios6

5
推荐指数
1
解决办法
1911
查看次数

从.vimrc加载vim插件时检测到的错误

我已经在debian系统上安装了vim 7.3以及我从网上下载的一些vimrc.它曾经在我的其他debian机器上工作正常,但在这里我得到这些错误消息,而我加载vim编辑器.

以下是错误:

Error detected while processing /home/tejinder/.vim/plugin/gundo.vim:
line  196:
E319: Sorry, the command is not available in this version: python << ENDPYTHON
line  197:
E492: Not an editor command: def asciiedges(seen, rev, parents):
line  199:
E121: Undefined variable: rev
E15: Invalid expression: rev not in seen:
line  221:
E133: :return not inside a function
line  231:
E133: :return not inside a function
line  233:
E133: :return not inside a function
line  235:
E133: :return not inside a function
line …
Run Code Online (Sandbox Code Playgroud)

python vi vim editor

4
推荐指数
1
解决办法
2791
查看次数

如何以编程方式设置NSView层

这样做的正确方法是什么?这是我正在尝试的.但是dotLayer上从不调用display:

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
    DotLayer *dotLayer = [[DotLayer alloc]init ];
    dotLayer.frame= CGRectMake(10, 10, 100, 100);
    dotLayer.nDots = 4;
    NSView *contentView = window.contentView;
    CALayer *layer = [[CALayer alloc]init];
    layer.frame = CGRectMake(0,0,200,200);
    contentView.layer = layer;
    [layer addSublayer:dotLayer];
    [dotLayer setNeedsDisplay];
}
Run Code Online (Sandbox Code Playgroud)

DotLayer是CALayer的子类.

cocoa calayer

4
推荐指数
1
解决办法
2134
查看次数

如何在应用程序中使用iPhone铃声

我想在我的应用程序中使用iPhone的铃声.这可能吗?请帮助我坚持这一点,

谢谢

iphone

4
推荐指数
1
解决办法
1694
查看次数

将NSString转换为特定于语言环境的NSNumber

我正在使用KeyboardType = UIKeyboardTypeDecimalPad和在某些手机上你看到左下角的","而不是".".这取决于手机的语言设置!随着"." 版本一切正常,当我使用[NSNumber numberWithFloat:[textField.text floatValue]]但是使用","版本时它表示2.0为2.5.有人知道解决方法吗?

iphone nsnumber nsstring ios

4
推荐指数
1
解决办法
1795
查看次数

我如何使用 NSTask 获得类似于 Tail -f 的东西

我需要实时将最后添加的行读取到日志文件中,并捕获添加的那一行。

类似于 Tail -f 的东西。

所以我的第一次尝试是使用 NSTask 使用 Tail -f。

使用以下代码我看不到任何输出:

    NSTask *server = [[NSTask alloc] init];
    [server setLaunchPath:@"/usr/bin/tail"];
    [server setArguments:[NSArray arrayWithObjects:@"-f", @"/path/to/my/LogFile.txt",nil]];

    NSPipe *outputPipe = [NSPipe pipe];
    [server setStandardInput:[NSPipe pipe]];
    [server setStandardOutput:outputPipe];

    [server launch];
    [server waitUntilExit];
    [server release];

    NSData *outputData = [[outputPipe fileHandleForReading] readDataToEndOfFile];
    NSString *outputString = [[[NSString alloc] initWithData:outputData encoding:NSUTF8StringEncoding] autorelease];
    NSLog (@"Output \n%@", outputString);
Run Code Online (Sandbox Code Playgroud)

使用时我可以看到预期的输出:

[server setLaunchPath:@"/bin/ls"];
Run Code Online (Sandbox Code Playgroud)
  1. 如何捕获该尾部 NSTask 的输出?

  2. 这种方法有什么替代方法,我可以打开一个流到文件,每次添加一行时,将它输出到屏幕上?(基本日志功能)

objective-c tail nstask

4
推荐指数
1
解决办法
1355
查看次数

iOS上的C#下拉组合框相当于什么?

我正在使用Objective-C for iPhone编写应用程序.

在此应用程序中,用户在输入新记录时需要具有查找功能(例如状态,性别,电话类型等).在C#中我通常使用下拉组合或类似的东西来完成这项任务.Objective-C中的等价物是什么?有人可以给我看一个样例申请吗?

iphone objective-c

4
推荐指数
1
解决办法
7805
查看次数

核心数据数据访问模式?

在我的应用程序中,我将所有这些NSFetchRequests用于遍布不同视图控制器的相同NSManagedObjects,这对我来说似乎很疯狂,是否有一个很好的数据访问模式,可以将我需要的内容放在一个地方?

iphone core-data ipad

4
推荐指数
1
解决办法
226
查看次数

iOS如何检测电源线是否堵塞

我正在制作GPS应用程序,并且根据电源是否可用而改变准确性(即车载充电器)

有没有办法在后台运行一些不断检查设备是否正在接收电源的东西?

我知道如何检查电源是否已连接.但问题是如果用户在家并且已连接.他拔掉设备以便跑出去.然后决定出去玩.我的应用程序在启动时检查电池状态.我怎样才能一次又一次地检查它.我不想耗尽他的电池,因为他正在使用我的应用程序!

我们计划仅支持iOS 5及更高版本(无需向后兼容iOS 4和3)

谢谢

notifications push-notification nsnotificationcenter ios5

4
推荐指数
1
解决办法
4580
查看次数

IOS忽略ModalPresentationStyle和ModalTransitionStyle并呈现全屏

我的应用程序完全忽略了UIModalPresentationFormSheet和U​​IModalTransitionStyleCrossDissolve.它始终弹出全屏并具有默认转换.

它在我的真实应用程序上完成.然后,我做了一个空白测试应用程序,它做了同样的事情.

这很简单:我的AppDelegate加载KBViewController作为根视图.KBViewController尝试呈现一个空白视图控制器(KBModalViewController).KBModalViewController.xib中的视图设置为"FormSheet"大小

我的视图控制器:

@implementation KBViewController


-(void)viewDidAppear:(BOOL)animated{
    [self setModalPresentationStyle:UIModalPresentationFormSheet];
    [self setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
    KBModalViewController *m = [[KBModalViewController alloc] initWithNibName:nil bundle:nil];
    [self presentViewController:m animated:YES completion:nil];

    //Also tried the depreciated presentModalViewController, same result
    //[self presentModalViewController:m animated:YES];
}
Run Code Online (Sandbox Code Playgroud)

我正在使用Xcode 4.61.我已经编译成ipad 5.1,ipad 6.1和6.1上的真正的ipad 2.总而言之.

ipad ios

4
推荐指数
1
解决办法
4015
查看次数