小编use*_*582的帖子

当对象移动到某个帧时,如何停止UIPanGestureRecognizer

我有一个图像类型的对象,我正在使用UIPanGestureRecognizer移动,我需要在对象到达某个帧时停止识别UIPanGestureRecognizer.

    UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(move:)];
    [panRecognizer setMinimumNumberOfTouches:1];
    [panRecognizer setMaximumNumberOfTouches:1];
    [panRecognizer setDelegate:self];
    [templatePhotoPlaceholderView addGestureRecognizer:panRecognizer];

-(void)move:(UIPanGestureRecognizer *)gestureRecognizer
{
    CGPoint translatedPoint = [gestureRecognizer translationInView:templatePhotoPlaceholderView];

    if([gestureRecognizer state] == UIGestureRecognizerStateBegan) {
        _firstX = [imageview center].x;
        _firstY = [imageview center].y;
    }



    translatedPoint = CGPointMake(_firstX+translatedPoint.x, _firstY+translatedPoint.y);
    //NSLog(@" Move center point :%@", NSStringFromCGPoint(translatedPoint));

    [imageview setCenter:translatedPoint];  

}
Run Code Online (Sandbox Code Playgroud)

我怎么能这样做?

iphone objective-c ipad uigesturerecognizer uipangesturerecognizer

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

如何在通用应用中区分iPhone和iPad?

我想区分iPhone和iPad的控制器.

        #ifdef __IPHONE_NA
            {

            UINavigationBar *ipadNavBar = [[UINavigationBar alloc] initWithFrame: CGRectMake(0.0f, 0.0f, 768.0f, 50.0f)];
            [[self view] addSubview: ipadNavBar];

            UINavigationItem *ipadNavItem = [[UINavigationItem alloc] initWithTitle: @"EMPLOYEE"];
            [ipadNavBar pushNavigationItem:ipadNavItem animated:NO];
            }
    else 
        {

        UINavigationBar *ipadNavBar = [[UINavigationBar alloc] initWithFrame: CGRectMake(0.0f, 0.0f, 360.0f, 45.0f)];
        [[self view] addSubview: ipadNavBar];



UINavigationItem *ipadNavItem = [[UINavigationItem alloc] initWithTitle: @"EMPLOYEE"];
    [ipadNavBar pushNavigationItem:ipadNavItem animated:NO];
    }
Run Code Online (Sandbox Code Playgroud)

如果说错误没有终止#ifdef

这种方法是否正确?

iphone ipad ios

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

UI问题与ipad的kal日历?

iPad版Kal Calendar有UI问题.在iPad上有一个空的空间,但在iPhone上它很好.我怎样才能让它适合iPad上的框架?

if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
    [kal.view setFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
}
else if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
    [kal.view setFrame:CGRectMake(0, 0,768 ,1004)];

}
Run Code Online (Sandbox Code Playgroud)

我尝试使用上面列出的代码,但它对我不起作用!

在此输入图像描述

cocoa-touch objective-c ipad ios

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