2012-08-28 24 views
0

我發現Objective-c我需要這樣做,但是如何在Ruby中重新編寫它?紅寶石運動隱藏UISplitViewController上的圓角

- (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

怎麼是這樣的:

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