更改NIB大小

时间:2011-10-20 23:01:25

标签: iphone objective-c ios uikit

有人可以告诉我如何更改笔尖框架宽度以匹配UITableViewCell。现在,当我直接编辑笔尖时,它设置为320,但是当我在Ipad中打开它时,它仍然是320宽度。

 - (void)didSelectObject:(id)object atIndexPath:(NSIndexPath*)path {
PMID = nil;
NSString *str = [[NSString stringWithFormat:@"%@",[object URL]] stringByReplacingOccurrencesOfString:@"tt://actions/"
                                     withString:@""];


NSArray *firstSplit = [str componentsSeparatedByString:@"/"];
NSString *number1 = [firstSplit objectAtIndex:0];    
NSString *number2 = [firstSplit objectAtIndex:1];

TTTableViewCell* cell = (TTTableViewCell*) [self.tableView 
                                            cellForRowAtIndexPath:path]; 

NSArray *nib = nil;
if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"Admin"] isEqualToString:@"Admin"]){
nib = [[NSBundle mainBundle] loadNibNamed:@"MenuView" 
                                        owner:self options:nil];
}else if ([[NSString stringWithFormat:@"%d",[number1 intValue]] isEqualToString:[NSString stringWithFormat:@"%@", [[NSUserDefaults standardUserDefaults] objectForKey:@"IDKey"]]]){
nib = [[NSBundle mainBundle] loadNibNamed:@"MenuView2" 
                                    owner:self options:nil];
}else{
nib = [[NSBundle mainBundle] loadNibNamed:@"MenuView3" 
                                    owner:self options:nil];
}
  UIView *menuView = nil;

for (id object in nib) {
    if ([object isKindOfClass:[UIView class]]) {
        menuView = (UIView *) object;
    }
}

[self showMenu:menuView forCell:cell animated:YES]; 
}

0 个答案:

没有答案