ruby motion隐藏UISplitViewController上的圆角

时间:2012-08-28 10:16:54

标签: objective-c uisplitviewcontroller rubymotion

我发现Objective-c我需要这样做但是你怎么用红宝石重写呢?

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{  
    [self performSelector:@selector(fixRoundedSplitViewCorner) withObject:NULL afterDelay:0];
}

-(void) fixRoundedSplitViewCorner {  
    [self explode:[[UIApplication sharedApplication] keyWindow] level:0];  
}

-(void) explode:(id)aView level:(int)level 
{   
    if ([aView isKindOfClass:[UIImageView class]]) {
        UIImageView* roundedCornerImage = (UIImageView*)aView;
        roundedCornerImage.hidden = YES;
    }
    if (level < 2) 
    {
        for (UIView *subview in [aView subviews]) {
            [self explode:subview level:(level + 1)];
        }
    }
}

1 个答案:

答案 0 :(得分:1)

这样的事情怎么样:

def didRotateFromInterfaceOrientation(fromInterfaceOrientation)
# you can just skip calling performSelector and call the method directly
#   self.performSelector('fixRoundedSplitViewCorner', withObject:nil, afterDelay:0)
    self.fixRoundedSplitViewCorner()
end

def fixRoundedSplitViewCorner
    self.explode(UIApplication.sharedApplication.keyWindow, level:0)
end

def explode(aView, level:level)
    if aView.class == UIImageView
        aView.hidden = true
    end
    if level < 2
        for subview in aView.subviews
            self.explode(subview, level:(level + 1))
        end
    end
end