我正在构建一个Watch应用程序,其中我要覆盖WKInterface Image与一组WKInterfaceLabel对象.在StoryBoard编辑器中似乎无法做到这一点.

有没有人能够为Watch App设计出相互之间的观点?

PS.我知道WKInterfaceGroup setBackgroundImage方法.因为我想在WKInterfaceImage里面做一些动画,所以setBackgroundImage不会让我失望

解决方法

您无法将WKInterfaceObjects布置在彼此之上.您可以将标签渲染在图像上,然后进行设置.您将必须为动画的每个帧渲染标签.我在手表应用程序中执行此按钮.我生成一个我的UI的大块图像,然后生成动画的每一帧,并覆盖每个帧的按钮文本.然后剪切每个框架的图像,以便我可以在每个按钮上的动画.当您使用该应用程序时,它看起来像是在按钮下的动画,实际上它是4种不同的动画在4个不同的按钮.

编辑

我想我会添加一些更多的细节.这是我的应用程序的屏幕截图.我猜你想做类似的事情.

首先在我的故事板上,您需要确保您的组的间距为零.

要创建这个UI,我使用这个助手类.我已经编辑了这个课程,只关注所需的部分.

typedef struct
{
    CGRect top;
    CGRect left;
    CGRect right;
    CGRect bottom;
} ButtonRects;

@interface GPWatchMapImage ()

@property (readwrite,nonatomic) UIImage* topImage;
@property (readwrite,nonatomic) UIImage* bottomImage;
@property (readwrite,nonatomic) UIImage* leftimage;
@property (readwrite,nonatomic) UIImage* rightimage;

@property (readwrite,nonatomic) CGRect topRect;
@property (readwrite,nonatomic) CGRect bottomrect;
@property (readwrite,nonatomic) CGRect leftRect;
@property (readwrite,nonatomic) CGRect rightRect;


@property (readwrite,nonatomic) UIImage* fullImageWithoutArrows;

@property BOOL addedArrows;


@end

@implementation GPWatchMapImage

-(instancetype)init
{
    self = [super init];
    if (self)
    {

    }
    return self;
}



-(UIImage*)leftimage
{
    if (_leftimage == nil)
    {
        [self breakUpForButtons];
    }
    return _leftimage;
}

-(UIImage*)rightimage
{
    if (_rightimage == nil)
    {
        [self breakUpForButtons];
    }
    return _rightimage;
}

-(UIImage*)topImage
{
    if (_topImage == nil)
    {
        [self breakUpForButtons];
    }
    return _topImage;
}

-(UIImage*)bottomImage
{
    if (_bottomImage == nil)
    {
        [self breakUpForButtons];
    }
    return _bottomImage;
}

-(UIImage*)fullImageWithoutArrows
{
    [self fullImage]; //make sure we have the full image
    if (_fullImageWithoutArrows != nil)
    {
        return _fullImageWithoutArrows;
    }
    return _fullImage;
}

-(UIImage*)fullImage
{
    if (_fullImage == nil)
    {
        //This is the rect to create the image in
        CGRect rect = CGRectMake(0,self.watchSize.width,self.watchSize.height);

        //This is how I generate map images.  You will need to do something else
        self.generatedMapInfo = [[GPCustomMapMaker instance] makeCustomMapFromConfig:self.mapConfig];
        _fullImage = self.generatedMapInfo.mapImage;

    }

    if (self.showMapArrows && !self.addedArrows)
    {
        //Add the arrows
        [self addButtonArrowsToFullImage];
    }


    return _fullImage;
}


-(void)addButtonArrowsToFullImage
{
    self.addedArrows = YES;

    ButtonRects rects = [self buttonRects];
    UIImage* img = self.fullImage;
    self.fullImageWithoutArrows = img;  //save for animations
    UIGraphicsBeginImageContext(img.size);

    UIColor* color = [UIColor colorWithRed:.4 green:.4 blue:.4 alpha:.6];

    //CGSize arrowSize = CGSizeMake(24,4);
    CGSize arrowSize = CGSizeMake(48,8);
    CGFloat edgeOffset = 26;
    CGContextRef ctx = UIGraphicsGetCurrentContext();
    CGContextSetlinewidth(ctx,6);
    CGContextSetLineJoin(ctx,kCGLineJoinRound);
    CGContextSetLineCap(ctx,kCGLineCapRound);
    CGContextSetstrokeColorWithColor(ctx,color.CGColor);

    [img drawAtPoint:CGPointMake(0,0)];


    //Left arrow
    CGPoint leftCenter = CGPointMake(rects.left.origin.x + edgeOffset,rects.left.origin.y + rects.left.size.height/2);
    CGContextBeginPath(ctx);
    CGContextMovetoPoint(ctx,leftCenter.x + arrowSize.height,leftCenter.y - arrowSize.width/2);
    CGContextAddLinetoPoint(ctx,leftCenter.x,leftCenter.y);
    CGContextAddLinetoPoint(ctx,leftCenter.y + arrowSize.width/2);
    CGContextstrokePath(ctx);

    CGPoint rightCenter = CGPointMake(rects.right.origin.x + rects.right.size.width - edgeOffset,rects.right.origin.y + rects.right.size.height/2);
    CGContextBeginPath(ctx);
    CGContextMovetoPoint(ctx,rightCenter.x,rightCenter.y - arrowSize.width/2);
    CGContextAddLinetoPoint(ctx,rightCenter.x + arrowSize.height,rightCenter.y);
    CGContextAddLinetoPoint(ctx,rightCenter.y + arrowSize.width/2);
    CGContextstrokePath(ctx);


    CGPoint topCenter = CGPointMake(rects.top.origin.x + rects.top.size.width/2,rects.top.origin.y + edgeOffset);
    CGContextBeginPath(ctx);
    CGContextMovetoPoint(ctx,topCenter.x - arrowSize.width/2,topCenter.y + arrowSize.height);
    CGContextAddLinetoPoint(ctx,topCenter.x,topCenter.y);
    CGContextAddLinetoPoint(ctx,topCenter.x + arrowSize.width/2,topCenter.y + arrowSize.height);
    CGContextstrokePath(ctx);

    CGPoint bottomCenter = CGPointMake(rects.bottom.origin.x + rects.bottom.size.width/2,rects.bottom.origin.y + rects.bottom.size.height - edgeOffset);
    CGContextBeginPath(ctx);
    CGContextMovetoPoint(ctx,bottomCenter.x - arrowSize.width/2,bottomCenter.y);
    CGContextAddLinetoPoint(ctx,bottomCenter.x,bottomCenter.y + arrowSize.height);
    CGContextAddLinetoPoint(ctx,bottomCenter.x + arrowSize.width/2,bottomCenter.y);
    CGContextstrokePath(ctx);


    UIImage* imgWithButtons = UIGraphicsGetimageFromCurrentimageContext();
    UIGraphicsEndImageContext();
    _fullImage = imgWithButtons;
}

-(UIImage*)subImageInRect:(CGRect)rect fromImage:(UIImage*)image
{
    UIGraphicsBeginImageContext(rect.size);

    [image drawInRect:CGRectMake(-rect.origin.x,-rect.origin.y,image.size.width,image.size.height)];

    UIImage* newImage = UIGraphicsGetimageFromCurrentimageContext();
    UIGraphicsEndImageContext();
    return newImage;
}

-(ButtonRects)buttonRects
{
    UIImage* img = self.fullImage;
    CGSize size = self.watchSize;
    CGFloat topHeight = size.height * .25;
    CGFloat bottomHeight = size.height * .25;
    CGFloat middleHeight = size.height * .5;

    CGRect topRect = CGRectMake(0,size.width,topHeight);
    CGRect leftRect = CGRectMake(0,topHeight,img.size.width/2.0,middleHeight);
    CGRect rightRect = CGRectMake(img.size.width/2.0,middleHeight);
    CGRect bottomrect = CGRectMake(0,topHeight + middleHeight,bottomHeight);

    ButtonRects rects;
    rects.top = topRect;
    rects.bottom = bottomrect;
    rects.left = leftRect;
    rects.right = rightRect;

    return rects;
}

-(void)breakUpForButtons
{
    UIImage* img = self.fullImage;
    ButtonRects rects = [self buttonRects];

    _topImage = [self subImageInRect:rects.top fromImage:img];
    _leftimage = [self subImageInRect:rects.left fromImage:img];
    _rightimage = [self subImageInRect:rects.right fromImage:img];
    _bottomImage = [self subImageInRect:rects.bottom fromImage:img];
}

@end

接下来在我的WKInterfaceController类中,我做这个动画.

typedef NS_ENUM(NSInteger,GPWatchImageAnimation)
{
    GPWatchImageAnimationNone,GPWatchImageAnimationSlideLeftToRight,GPWatchImageAnimationSlideRighToLeft,GPWatchImageAnimationSlidetopToBottom,GPWatchImageAnimationSlideBottomToTop,GPWatchImageAnimationZoomIn,GPWatchImageAnimationZoomOut
};

#define kNumImagesInMapAnimations 6
#define kMapAnimatinonDuration 0.4

...

-(void)updateMapImageWithAnimation:(GPWatchImageAnimation)animation
{
    GPWatchMapImage* prevIoUsImage = self.currentMapImage;

    //This gets the size of the full image that you want    
    CGSize size = [self mapSize];
    self.currentMapImage = [[GPWatchMapImage alloc] init];
    self.currentMapImage.watchSize = size;

        //Check if we have a prevIoUs image to animate from
        if (prevIoUsImage != nil && animation != GPWatchImageAnimationNone)
        {
            NSDictionary* animatedImage = [self animateFromImage:prevIoUsImage toImage:self.currentMapImage withAnimation:animation];
            [self.mapTopImage setimage:[animatedImage objectForKey:@"top"]];
            [self.mapLeftimage setimage:[animatedImage objectForKey:@"left"]];
            [self.mapRightimage setimage:[animatedImage objectForKey:@"right"]];
            [self.mapBottomImage setimage:[animatedImage objectForKey:@"bottom"]];

            [self.mapTopImage startAnimatingWithImagesInRange:NSMakeRange(0,kNumImagesInMapAnimations) duration:kMapAnimatinonDuration repeatCount:1];
            [self.mapLeftimage startAnimatingWithImagesInRange:NSMakeRange(0,kNumImagesInMapAnimations) duration:kMapAnimatinonDuration repeatCount:1];
            [self.mapRightimage startAnimatingWithImagesInRange:NSMakeRange(0,kNumImagesInMapAnimations) duration:kMapAnimatinonDuration repeatCount:1];
            [self.mapBottomImage startAnimatingWithImagesInRange:NSMakeRange(0,kNumImagesInMapAnimations) duration:kMapAnimatinonDuration repeatCount:1];
        }
        else
        {
            [self.mapTopImage setimage:self.currentMapImage.topImage];
            [self.mapLeftimage setimage:self.currentMapImage.leftimage];
            [self.mapRightimage setimage:self.currentMapImage.rightimage];
            [self.mapBottomImage setimage:self.currentMapImage.bottomImage];
        }

}

-(NSDictionary*)animateFromImage:(GPWatchMapImage*)fromImage toImage:(GPWatchMapImage*)toImage withAnimation:(GPWatchImageAnimation)animation
{
    NSMutableArray* topAnimatedImages = [[NSMutableArray alloc] initWithCapacity:kNumImagesInMapAnimations];
    NSMutableArray* bottomAnimatedImages = [[NSMutableArray alloc] initWithCapacity:kNumImagesInMapAnimations];
    NSMutableArray* leftAnimatedImages = [[NSMutableArray alloc] initWithCapacity:kNumImagesInMapAnimations];
    NSMutableArray* rightAnimatedImages = [[NSMutableArray alloc] initWithCapacity:kNumImagesInMapAnimations];

    CGSize size = fromImage.fullImage.size;
    for (int step = 0; step < kNumImagesInMapAnimations; step++)
    {
        UIGraphicsBeginImageContext(size);

        //render this step
        if (animation == GPWatchImageAnimationSlideLeftToRight)
        {
            CGFloat stepSize = (size.width/2)/kNumImagesInMapAnimations;
            CGPoint fromPoint = CGPointMake(-(step+1)*stepSize,0);
            CGPoint toPoint = CGPointMake(size.width/2 - (step+1)*stepSize,0);
            [fromImage.fullImageWithoutArrows drawAtPoint:fromPoint];
            [toImage.fullImageWithoutArrows drawAtPoint:toPoint];
        }
        else if (animation == GPWatchImageAnimationSlideRighToLeft)
        {
            CGFloat stepSize = (size.width/2)/kNumImagesInMapAnimations;
            CGPoint fromPoint = CGPointMake((step+1)*stepSize,0);
            CGPoint toPoint = CGPointMake(-size.width/2 + (step+1)*stepSize,0);
            [fromImage.fullImageWithoutArrows drawAtPoint:fromPoint];
            [toImage.fullImageWithoutArrows drawAtPoint:toPoint];
        }
        else if (animation == GPWatchImageAnimationSlidetopToBottom)
        {
            CGFloat stepSize = (size.height/2)/kNumImagesInMapAnimations;
            CGPoint fromPoint = CGPointMake(0,(step+1)*stepSize);
            CGPoint toPoint = CGPointMake(0,-size.height/2 + (step+1)*stepSize);
            [fromImage.fullImageWithoutArrows drawAtPoint:fromPoint];
            [toImage.fullImageWithoutArrows drawAtPoint:toPoint];
        }
        else if (animation == GPWatchImageAnimationSlideBottomToTop)
        {
            CGFloat stepSize = (size.height/2)/kNumImagesInMapAnimations;
            CGPoint fromPoint = CGPointMake(0,-(step+1)*stepSize);
            CGPoint toPoint = CGPointMake(0,size.height/2 - (step+1)*stepSize);
            [fromImage.fullImageWithoutArrows drawAtPoint:fromPoint];
            [toImage.fullImageWithoutArrows drawAtPoint:toPoint];
        }
        else if (animation == GPWatchImageAnimationZoomOut)
        {
            CGFloat yStepSize = (size.height/2)/kNumImagesInMapAnimations;
            CGFloat xStepSize = (size.width/2)/kNumImagesInMapAnimations;
            //CGRect fromrect = CGRectMake((step + 1)*xStepSize,(step + 1)*yStepSize,size.width - 2*(step + 1)*xStepSize,size.height - 2*(step + 1)*yStepSize);
            CGRect toRect = CGRectMake(-size.width/2 + (step+1)*xStepSize,-size.height/2 + (step+1)*yStepSize,size.width + 2*(kNumImagesInMapAnimations - step - 1)*xStepSize,size.height + 2*(kNumImagesInMapAnimations - step - 1)*yStepSize);
            [toImage.fullImageWithoutArrows drawInRect:toRect];

            //double alpha = (double)(kNumImagesInMapAnimations - step - 1)/(double)kNumImagesInMapAnimations;
            //CGContextSetAlpha(UIGraphicsGetCurrentContext(),alpha);
            //[fromImage.fullImageWithoutArrows drawInRect:fromrect];
            //CGContextSetAlpha(UIGraphicsGetCurrentContext(),1.0);
        }
        else if (animation == GPWatchImageAnimationZoomIn)
        {
            if (step == kNumImagesInMapAnimations -1)
            {
                [toImage.fullImageWithoutArrows drawAtPoint:CGPointMake(0,0)];
            }
            else
            {
                CGFloat yStepSize = (size.height/2)/kNumImagesInMapAnimations;
                CGFloat xStepSize = (size.width/2)/kNumImagesInMapAnimations;
                CGRect fromrect = CGRectMake(-(step + 1)*xStepSize,-(step + 1)*yStepSize,size.width + 2*(step + 1)*xStepSize,size.height + 2*(step + 1)*yStepSize);
                //CGRect toRect = CGRectMake(-size.width/2 + (step+1)*xStepSize,size.height + 2*(kNumImagesInMapAnimations - step - 1)*yStepSize);
                [fromImage.fullImageWithoutArrows drawInRect:fromrect];
                //[toImage.fullImageWithoutArrows drawInRect:fromrect];
            }
        }
        else
        {
            [toImage.fullImageWithoutArrows drawAtPoint:CGPointMake(0,0)];
        }

        UIImage* stepImg = UIGraphicsGetimageFromCurrentimageContext();
        UIGraphicsEndImageContext();


        //Get each of the pieces of the image
        GPWatchMapImage* mapImage = [[GPWatchMapImage alloc] init];
        mapImage.showMapArrows = self.showMapArrows;
        mapImage.fullImage = stepImg;
        mapImage.watchSize = [self mapSize];
        [topAnimatedImages addobject:mapImage.topImage];
        [bottomAnimatedImages addobject:mapImage.bottomImage];
        [leftAnimatedImages addobject:mapImage.leftimage];
        [rightAnimatedImages addobject:mapImage.rightimage];
    }

    UIImage* topAnimatedImage = [UIImage animatedImageWithImages:topAnimatedImages duration:kMapAnimatinonDuration];
    UIImage* bottomAnimatedImage = [UIImage animatedImageWithImages:bottomAnimatedImages duration:kMapAnimatinonDuration];
    UIImage* leftAnimatedImage = [UIImage animatedImageWithImages:leftAnimatedImages duration:kMapAnimatinonDuration];
    UIImage* rightAnimatedImage = [UIImage animatedImageWithImages:rightAnimatedImages duration:kMapAnimatinonDuration];
    return @{@"top": topAnimatedImage,@"bottom": bottomAnimatedImage,@"left": leftAnimatedImage,@"right": rightAnimatedImage};
}

ios – 可以将视图放在彼此之上的更多相关文章

  1. CSS中实现动画效果-附案例

    这篇文章主要介绍了 CSS中实现动画效果并附上案例代码及实现效果,就是CSS动画样式处理,动画声明需要使用@keyframes name,后面的name是人为定义的动画名称,下面我们来看看文章的具体实现内容吧,需要的小伙伴可以参考一下

  2. ios – 围绕其中心点旋转UIImageView?

    我在UIImageView中有一个透明的png,我想围绕它的中心点旋转.代码应该非常简单:图像以正确的速度/时间和直角旋转,但其位置会发生偏移.这是一个正在发生的事情的例子:灰色方块只是为了在屏幕上显示位置.透明的png是另一个图.白色虚线显示UIImageView的中心.图像的左侧显示图像的原始位置,右侧显示使用上述代码旋转后的图像.黑色和白色圆圈位于图像文件的中心.有什么东西我不见了吗?

  3. ios – 将UIView的框架和角半径合在一起

    码:此代码是UIView的扩展.解决方法我像这样调整我的圈子视图:

  4. ios – 如何在Cocos2D 3.x中为CCSprite制作动画?

    你知道如何在新的Cocos2Dv3.x中动画CCSprite吗?许多类都被改变了,旧的方法似乎不起作用.任何的想法?谢谢.额外信息解决方法这是它的工作原理:

  5. ios5 – UIPageViewController转换速度/持续时间?

    有没有办法改变页面卷曲过渡的默认持续时间?这是快速的方式然后我希望它会是?谢谢沙尼解决方法Hy,这是使用默认转换来卷曲页面和指定卷曲速度的方法.祝你工作顺利.

  6. ios – 重用UICollectionView中的单元格时,会短暂显示重用的UICollectionViewCell的旧内容

    我正在使用UICollectionView来显示从URL异步加载的图片网格.我的集合视图使用可重用单元格来显示UICollectionViewCells.当不重复使用单元格时,所有内容都会正确显示,但是当我滚动一下时,重用的单元格会在它们开始正常行为之前短暂闪烁旧内容.以下是自定义UICollectionViewController的实现:这是自定义UICollectionViewCell的实现.

  7. 在iOS中移动UICollectionView的单元格?

    我有一个UICollectionView.I我试图给它作为SpringBoard的功能.我有能力给每个单元格摇动动画.但是我想当图标摇动时,我应该能够移动他们.为了摇动单元格,我已经在每个单元格上添加了UILongPressGesture.当手势结束时,我已经添加了一个自定义动画.还在左上角添加了一个删除按钮.长按手势代码:添加手势到集合视图回调方法单元格在inde路径项在这里工作正常为了移动单元

  8. iOS:CAShapeLayer绘制非直视图像并为其形状设置动画

    我一直在阅读有关CAShapeLayer的文档,但我仍然不太明白.根据我的理解,Layer始终是扁平的,其大小始终是矩形.另一方面,CAShapeLayer允许您定义不仅仅是矩形的图层.它可以是圆形,三角形等,只要您将它与UIBezierPaths一起使用即可.我的理解是在这里吗?

  9. ios – CGContextSaveGState:应用启动时的无效上下文0x0

    FWW我的应用程序大多是用Swift2.0编写的,在iOS9上使用Xcode7b6.解决方法我遇到同样的问题,其原因是,我正在为不同的屏幕设置不同的状态栏样式.因此,我需要在plist中添加“查看基于控制器的状态栏外观”键.如果我删除此键,警告消失.

  10. ios – 可以将视图放在彼此之上

    我正在构建一个Watch应用程序,其中我要覆盖WKInterfaceImage与一组WKInterfaceLabel对象.在StoryBoard编辑器中似乎无法做到这一点.有没有人能够为WatchApp设计出相互之间的观点?

随机推荐

  1. iOS实现拖拽View跟随手指浮动效果

    这篇文章主要为大家详细介绍了iOS实现拖拽View跟随手指浮动,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下

  2. iOS – genstrings:无法连接到输出目录en.lproj

    使用我桌面上的项目文件夹,我启动终端输入:cd然后将我的项目文件夹拖到终端,它给了我路径.然后我将这行代码粘贴到终端中找.-name*.m|xargsgenstrings-oen.lproj我在终端中收到此错误消息:genstrings:无法连接到输出目录en.lproj它多次打印这行,然后说我的项目是一个目录的路径?没有.strings文件.对我做错了什么的想法?

  3. iOS 7 UIButtonBarItem图像没有色调

    如何确保按钮图标采用全局色调?解决方法只是想将其转换为根注释,以便为“回答”复选标记提供更好的上下文,并提供更好的格式.我能想出这个!

  4. ios – 在自定义相机层的AVFoundation中自动对焦和自动曝光

    为AVFoundation定制图层相机创建精确的自动对焦和曝光的最佳方法是什么?

  5. ios – Xcode找不到Alamofire,错误:没有这样的模块’Alamofire’

    我正在尝试按照github(https://github.com/Alamofire/Alamofire#cocoapods)指令将Alamofire包含在我的Swift项目中.我创建了一个新项目,导航到项目目录并运行此命令sudogeminstallcocoapods.然后我面临以下错误:搜索后我设法通过运行此命令安装cocoapodssudogeminstall-n/usr/local/bin

  6. ios – 在没有iPhone6s或更新的情况下测试ARKit

    我在决定下载Xcode9之前.我想玩新的框架–ARKit.我知道要用ARKit运行app我需要一个带有A9芯片或更新版本的设备.不幸的是我有一个较旧的.我的问题是已经下载了新Xcode的人.在我的情况下有可能运行ARKit应用程序吗?那个或其他任何模拟器?任何想法或我将不得不购买新设备?解决方法任何iOS11设备都可以使用ARKit,但是具有高质量AR体验的全球跟踪功能需要使用A9或更高版本处理器的设备.使用iOS11测试版更新您的设备是必要的.

  7. 将iOS应用移植到Android

    我们制作了一个具有2000个目标c类的退出大型iOS应用程序.我想知道有一个最佳实践指南将其移植到Android?此外,由于我们的应用程序大量使用UINavigation和UIView控制器,我想知道在Android上有类似的模型和实现.谢谢到目前为止,guenter解决方法老实说,我认为你正在计划的只是制作难以维护的糟糕代码.我意识到这听起来像很多工作,但从长远来看它会更容易,我只是将应用程序的概念“移植”到android并从头开始编写.

  8. ios – 在Swift中覆盖Objective C类方法

    我是Swift的初学者,我正在尝试在Swift项目中使用JSONModel.我想从JSONModel覆盖方法keyMapper,但我没有找到如何覆盖模型类中的Objective-C类方法.该方法的签名是:我怎样才能做到这一点?解决方法您可以像覆盖实例方法一样执行此操作,但使用class关键字除外:

  9. ios – 在WKWebView中获取链接URL

    我想在WKWebView中获取tapped链接的url.链接采用自定义格式,可触发应用中的某些操作.例如HTTP://我的网站/帮助#深层链接对讲.我这样使用KVO:这在第一次点击链接时效果很好.但是,如果我连续两次点击相同的链接,它将不报告链接点击.是否有解决方法来解决这个问题,以便我可以检测每个点击并获取链接?任何关于这个的指针都会很棒!解决方法像这样更改addobserver在observeValue函数中,您可以获得两个值

  10. ios – 在Swift的UIView中找到UILabel

    我正在尝试在我的UIViewControllers的超级视图中找到我的UILabels.这是我的代码:这是在Objective-C中推荐的方式,但是在Swift中我只得到UIViews和CALayer.我肯定在提供给这个方法的视图中有UILabel.我错过了什么?我的UIViewController中的调用:解决方法使用函数式编程概念可以更轻松地实现这一目标.

返回
顶部