小编Utt*_*dam的帖子

UIView的圆角用autolayout裁剪视图

我正在使用autolayout enable创建IOS应用程序.在我的视图应用中,有圆角(仅限顶角).我使用以下功能:

- (void)setMaskTo:(UIView*)view byRoundingCorners:(UIRectCorner)corners
{
    UIBezierPath *rounded = [UIBezierPath bezierPathWithRoundedRect:view.bounds
                                                  byRoundingCorners:corners
                                                        cornerRadii:CGSizeMake(5.0, 5.0)];
    CAShapeLayer *shape = [[CAShapeLayer alloc] init];
    [shape setPath:rounded.CGPath];
    view.layer.mask = shape;
}
Run Code Online (Sandbox Code Playgroud)

并在viewDidAppear中调用此函数,如:

-(void)viewDidAppear:(BOOL)animated {

    [self setMaskTo:contentView byRoundingCorners:UIRectCornerTopLeft|UIRectCornerTopRight]; 
}
Run Code Online (Sandbox Code Playgroud)

这工作正常,但问题是当应用程序处于横向模式时,当我从一个视图导航到另一个视图时,它会像纵向视图一样裁剪视图.请告诉我这种方法有什么问题吗?

rounded-corners ios autolayout

9
推荐指数
1
解决办法
3374
查看次数

如何在android中停止(杀死)AsyncTask

嗨我是android的新手:

我在GridView中显示图像拇指.为了获得更好的性能,我将异步加载它.

我的AsyncTask如下:

class BitmapWorkerTask extends AsyncTask<Integer, Void, Bitmap> {
        private final WeakReference<ImageView> imageViewReference;
        private int data = 0;
        private String image_path;

        public BitmapWorkerTask(ImageView imageView) {
            imageViewReference = new WeakReference<ImageView>(imageView);
        }

        @Override
        protected Bitmap doInBackground(Integer... params) {
            data = params[0];
            Bitmap picture = BitmapFactory.decodeFile(image_path);
            int width = picture.getWidth();
            int height = picture.getHeight();
            float aspectRatio = (float) width / (float) height;
            int newWidth = 98;
            int newHeight = (int) (98 / aspectRatio);
            return picture = Bitmap.createScaledBitmap(picture, newWidth,
                    newHeight, true);

        }

        @Override …
Run Code Online (Sandbox Code Playgroud)

android gridview asynchronous

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

认证完成后不会调用finishedWithAuth方法

我正在为iOS登录Google+登录.

我正在调用身份验证方法

  [signIn authenticate];
Run Code Online (Sandbox Code Playgroud)

我没有使用signin对接.

在这种情况下,验证后不会调用以下方法

- (void)finishedWithAuth: (GTMOAuth2Authentication *)auth
                   error: (NSError *) error
Run Code Online (Sandbox Code Playgroud)

请告诉我有没有办法处理回调?

authentication ios google-plus

0
推荐指数
1
解决办法
4253
查看次数