小编Sha*_* A.的帖子

如何在iPhoneOS中消除别名图层

我们已经让Reiner Knizia的钱出现了几个月了.它做得很好,所以我们一直在更新它,因为时间允许.然而,有一件事继续让我烦恼.我从来没有能够正确地将我的分层卡片用于消除别名.

这是一个示例:

替代文字

直线放置的卡非常干净,但每当它们成角度时,卡周围的黑线会变得锯齿状.我试过这个,取决于艺术品隐含的两条线和通过drawRect:绘制的线,它们都做同样的事情.我已经尝试过edgeAntiAliasingMask,据我所知,它没有做任何事情.我已经为子层设置为NO和YES尝试了maskToBounds.

现在我的卡被设置为CALayer,前面和后面都有子CALayers,另外还有一些其他的东西,比如闪电面具和变暗的面具.这是代码的一些片段:

   CArdLayer *theCardLayer = [CArdLayer layer];
   theCardLayer.edgeAntialiasingMask = kCALayerLeftEdge | kCALayerRightEdge | kCALayerBottomEdge | kCALayerTopEdge;

   theCardLayer.front = [CALayer layer];
   theCardLayer.front.edgeAntialiasingMask = kCALayerLeftEdge | kCALayerRightEdge | kCALayerBottomEdge | kCALayerTopEdge;
   theCardLayer.front.bounds = theCardLayer.bounds;
   theCardLayer.front.masksToBounds = YES;
   theCardLayer.front.contents = (id)[cardDrawing CGImage];

   [theCardLayer addSublayer:theCardLayer.front];
Run Code Online (Sandbox Code Playgroud)

等......

关于如何使卡实际上是反别名的任何想法?

iphone core-animation

7
推荐指数
1
解决办法
6051
查看次数

GKLocalPlayer在iOS6上使用模态转换错误进行Auth崩溃

我的应用程序记录了它是否已成功通过Game Center进行身份验证.当它开始新游戏或用户查看分数列表时,如果本地播放器未成功通过身份验证,并且该应用程序当时未尝试对用户进行身份验证,则会再次尝试.

(为什么?如果您从无网络区域移动到网络区域.)

不幸的是,在iOS6/XCode 4.5下,它开始崩溃了.或者至少在某些有限的情况下似乎:用户无法使用错误的密码和/或不存在的帐户登录.成功登录后,一切顺利.

在登录失败之后,当我去做一些导致进行reauth检查的事情时,我得到了这个:

2012年9月25日15:54:47.829 APP NAME [1493:907] * 断言故障- [UIWindowController过渡:fromViewController:toViewController:目标:didEndSelector:],/SourceCache/UIKit/UIKit-2372/UIWindowController.m:211

然后这实际上崩溃了:

2012年9月25日15:55:25.569 APP NAME [1493:907] *终止应用程序由于未捕获的异常'NSInternalInconsistencyException',原因:"试图开始从一个模态过渡:至<GKModalRootViewController 0x1cd8b2a0> <GKHostedAuthenticateViewController:0x1e31a350>而转型已在进行中.等待viewDidAppear/viewDidDisappear知道当前的过渡已经完成了"*第一掷调用堆栈:(0x394932a3 0x31db297f 0x3949315d 0x383fd2af 0x3640377b 0x36402fcf 0x394969c4 0x393edfeb 0x36521733 0x32a83d2d 0x3264b11f 0x3264a4b7 0x3264f1bd 0x39466f3b 0x393d9ebd 0x393d9d49 0x353132eb 0x3636b301 0x7e863 0x7e808)的libc ++ abi.dylib:终止叫抛出一个例外

这是麻烦的代码:

-(void)authenticateLocalUser {

    if (!self.checkingLocalPlayer) {
        self.checkingLocalPlayer = YES;
        GKLocalPlayer *thisPlayer = [GKLocalPlayer localPlayer];

        if (!thisPlayer.authenticated) {

            [[GKLocalPlayer localPlayer]
             authenticateWithCompletionHandler:^(NSError *error)
             {
                 [self finishGameCenterAuthWithError:error];
             }
             ];
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

知道我在这里做错了吗?

ios game-center ios6

6
推荐指数
1
解决办法
3760
查看次数

如何在iPhone上使不规则形状的透明CALayer变暗?

我正在将图像放入可能不规则透明的CALayer中:

 theCardLayer.front = [CALayer layer];
 theCardLayer.front.contents = (id)[cardDrawing CGImage];
Run Code Online (Sandbox Code Playgroud)

换句话说,它可能是填充图层的正方形,也可能是八角形,使角落透视.

我希望有时会使这一层变暗,但不会使透视位变暗.有关如何以程序化方式这样做的任何建议?

iphone core-graphics calayer ios

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

为什么Xcode 4.2不支持运行iOS 4.2.1的第二代iPod Touch

我最近升级到Xcode 4.2,支持SDK 5.0,但是自从我这样做以后,我的一个测试人员,他的iPod Touch第二代运行iOS 4.2.1,无法使用我的ad-hocs

我的目标设置为Base SDK:5.0(最新版本)和部署目标3.2,因此应该允许它.我也很确定测试人员的iOS版本,因为它已在testflightapp注册.

他看到的错误大致如下:"您的设备运行4.2.1,这比此版本所需的版本(4.3)"

我还注意到我现在只在我的方案中看到版本4.3和5.0.那里有什么应该调整的吗?

iphone ios-4.2 xcode4.2

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

获取核心数据中一对多关系的NSSet中属性的最小值

我在Core Data中设置了几个对象,其中一个是"Deck",其中一个是"Card"."卡片"有几个编号的关系,包括"id"."Deck"与卡片有一对多的关系.

在甲板中找到具有最小值的某些编号属性的最佳方法是什么,例如id?

显然我可以得到这样的卡片列表:

NSSet *cardList = self.cards;
Run Code Online (Sandbox Code Playgroud)

我想我可以构建一个表达式,以达到这样的最小值:

NSExpression *keyPathExpression = [NSExpression expressionForKeyPath:@"id"];
NSExpression *minExpression = [NSExpression expressionForFunction:@"min:" 
            arguments:[NSArray arrayWithObject:keyPathExpression]];
Run Code Online (Sandbox Code Playgroud)

但我无法理解如何使用该表达式来提取具有最小id值(或只是id的最小值)的卡.

core-data objective-c nsset

3
推荐指数
1
解决办法
2434
查看次数

UINavigationController中的Back Transition错误+横向方向的UITableViewController

我正在调用UINavigationController并且通常允许它使用任何主要方向:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

    // Return YES for supported orientations
    //    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);

    BOOL isAllowed;
    if ([allowedOrientations isEqualToString:@"portrait"]) {
        isAllowed = (interfaceOrientation == UIInterfaceOrientationPortrait ||
                     interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown);
    } else if ([allowedOrientations isEqualToString:@"landscape"]) {
        isAllowed = (interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
                     interfaceOrientation == UIInterfaceOrientationLandscapeRight);
    } else {
        isAllowed = YES;
    }

    return isAllowed;
}
Run Code Online (Sandbox Code Playgroud)

从那里我调用UITableViewController:

myTable = [[SimpleDocViewerTable alloc] initWithFrame:thisFrame];
self = [super initWithRootViewController:myTable];
Run Code Online (Sandbox Code Playgroud)

哪里:

@interface SimpleDocViewerTable : UITableViewController {
Run Code Online (Sandbox Code Playgroud)

表视图控制器和导航控制器似乎大多正确集成.当我将新页面推到导航控制器上时,无论我使用哪个方向,它都会从右向左正确滚动:

SimpleDocPageVC *thisVC = [[SimpleDocPageVC alloc] initWithView:docView];
thisVC.title = …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uitableview uinavigationcontroller ios

3
推荐指数
1
解决办法
1661
查看次数

为什么iOS 4.0中的数组显示为__NSArrayI(以及如何匹配)?

在以前的iPhoneOSes下,用于将自己标识为NSCFArray的对象现在似乎在运行iOS 4.0的设备下将自己标识为__NSArrayI.

知道这是怎么回事?我在任何文档中都找不到它.

另外,它与"[NSArray class]"不匹配.

它应该是一个简单的数组.它的定义如下:

NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:
                         thisPlayerName,@"name",
                         [NSNumber numberWithInt:[myTable.visiblePlayer.number intValue]],@"number",
                         playerCountArray,@"players",
                         [NSArray arrayWithObjects:@"easy",@"medium",@"hard",nil],@"opponent difficulty",
                         [NSNumber numberWithBool:[cardDecks getOptionBoolForKey:@"seeMoney"]],@"see money",
                         [cardDecks gameSpeedOptions],@"computer turn speed",
                         [NSArray arrayWithObjects:@"aqua",@"green",@"orange",@"purple",@"red",nil],@"player color",
                         nil];
Run Code Online (Sandbox Code Playgroud)

然后输入另一个字典,如下所示:

    myRecord = [[NSMutableDictionary alloc] initWithCapacity:5];
    [myRecord addEntriesFromDictionary:newDictionary];
Run Code Online (Sandbox Code Playgroud)

其他所有类都有我期望的类:NSCFString,NSCFNumber,NSCFBoolean,但不是数组,我无法弄清楚如何匹配它.

iphone ios4

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