小编Mat*_*att的帖子

像iPhone上的Facebook应用程序SplitView

我想创建一个iPhone应用程序,它使用类似于链接中所示的导航场景

截图

请注意我不希望这只适用于iPad,我希望它完全按照图片的方式为iPhone工作,当你点击一个tableview项目时它会隐藏tableview并使该视图全屏显示.我想知道如何做到这一点,因为我无法弄明白自己.

谢谢

iphone objective-c uinavigationcontroller tableview uisplitviewcontroller

121
推荐指数
3
解决办法
4万
查看次数

如何在UIView中加载xib文件

我到处都在搜索,到目前为止没有什么对我有用.

基本上我想要一个名为rootView.xib的.xib文件,在其中我希望有一个UIView(让我们称之为containerView)只占用屏幕的一半(因此会有常规视图和新视图).然后我想要一个名为firstView.xib的不同.xib文件并将其加载到containerView中.所以我可以在firstView.xib上有一堆东西和rootView.xib中的一堆不同的东西,并在rootView.xib中加载我的firstView.xib在containerView中,但由于它只占用了屏幕的一半,你仍然可以看到rootView.xib上的东西

objective-c xib uiview ios

109
推荐指数
6
解决办法
15万
查看次数

动画期间无法获取CALayer的当前位置

我试图实现一个动画,当你按住一个按钮时,它会向下动画一个块,当你释放时,它会将它动画回原来的位置,但无论如何我都无法获得动画块的当前位置.这是我的代码:

-(IBAction)moveDown:(id)sender{

   CGRect position = [[container.layer presentationLayer] frame];

    [movePath moveToPoint:CGPointMake(container.frame.origin.x, position.y)];

    [movePath addLineToPoint:CGPointMake(container.frame.origin.x, 310)];

    CAKeyframeAnimation *moveAnim = [CAKeyframeAnimation animationWithKeyPath:@"position"];
    moveAnim.path = movePath.CGPath;
    moveAnim.removedOnCompletion = NO;
    moveAnim.fillMode = kCAFillModeForwards;


    CAAnimationGroup *animGroup = [CAAnimationGroup animation];
    animGroup.animations = [NSArray arrayWithObjects:moveAnim, nil];
    animGroup.duration = 2.0;
    animGroup.removedOnCompletion = NO;
    animGroup.fillMode = kCAFillModeForwards;

    [container.layer addAnimation:animGroup forKey:nil];
}
-(IBAction)moveUp:(id)sender{
     CGRect position = [[container.layer presentationLayer] frame];

    UIBezierPath *movePath = [UIBezierPath bezierPath];

    [movePath moveToPoint:CGPointMake(container.frame.origin.x, position.y)];

    [movePath addLineToPoint:CGPointMake(container.frame.origin.x, 115)];

    CAKeyframeAnimation *moveAnim = [CAKeyframeAnimation animationWithKeyPath:@"position"];
    moveAnim.path = movePath.CGPath;
    moveAnim.removedOnCompletion = NO; …
Run Code Online (Sandbox Code Playgroud)

calayer cakeyframeanimation caanimation ios cgrect

12
推荐指数
1
解决办法
8216
查看次数

从NSArray中删除对象

如何从反转中删除对象NSArray.

目前我有一个NSMutableArray,然后我反过来

NSArray* reversedCalEvents = [[calEvents reverseObjectEnumerator] allObjects];
Run Code Online (Sandbox Code Playgroud)

现在我需要从项目中删除reversedCalEventscalEvents自动刷新数组根据条件显示的表.即

if(someInt == someOtherInt){
    remove object at index 0
}
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点?我无法让它发挥作用.

objective-c uitableview nsmutablearray nsarray ios

4
推荐指数
2
解决办法
4万
查看次数

AVAudioRecorder记录空白文件

以下是我的记录按钮方法的内容.它创建了所需的文件,但无论我记录多长时间,创建的文件总是4kb和0秒,我无法弄清楚它为什么无效.对于averagePowerPerChannel,计量也返回-120,我假设它是因为文件已损坏.

NSDictionary *recordSettings = [NSDictionary
                                    dictionaryWithObjectsAndKeys:
                                    [NSNumber numberWithInt:AVAudioQualityMin],
                                    AVEncoderAudioQualityKey,
                                    [NSNumber numberWithInt:16],
                                    AVEncoderBitRateKey,
                                    [NSNumber numberWithInt: 2],
                                    AVNumberOfChannelsKey,
                                    [NSNumber numberWithFloat:44100.0], 
                                    AVSampleRateKey,
                                    nil];
    NSError *error;
    NSArray *dirPaths;
    NSString *docsDir;

    dirPaths = NSSearchPathForDirectoriesInDomains(
                                                   NSDocumentDirectory, NSUserDomainMask, YES);
    docsDir = [dirPaths objectAtIndex:0];
    NSString *soundFilePath = [docsDir
                               stringByAppendingPathComponent:@"sound.caf"];

    NSURL *soundFileURL = [NSURL fileURLWithPath:soundFilePath];

    self.shotRecorder = [[AVAudioRecorder alloc] initWithURL:soundFileURL settings:recordSettings error:&error];
    self.shotRecorder.delegate = self;

    if (error)
    {
        NSLog(@"error: %@", [error localizedDescription]);

    } else {
        [self.shotRecorder prepareToRecord];
        self.shotRecorder.meteringEnabled = YES;
        [self.shotRecorder record];
        shotTimer = [NSTimer scheduledTimerWithTimeInterval: 0.03 target: self …
Run Code Online (Sandbox Code Playgroud)

avfoundation avaudioplayer avaudiorecorder

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