uibutton 使用settitle后如何修改其中文字对齐方式

 UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
            btn.frame = CGRectMake(5, self.alertView.lableView.frame.size.height + self.checkBox.frame.size.height + 80.0f, self.localView.frame.size.width - self.localView.frame.size.width/8*2-30, 30);
            self.leftBtn = btn;
            //[self.leftBtn setBackgroundImage: [UIImage imageNamed:@"popup_btn@2x.png"]forState:(UIControlStateNormal)];
            //[self.leftBtn setBackgroundImage: [UIImage imageNamed:@"popup_btn_onfocus@2x.png"]forState:(UIControlStateHighlighted)];
            [self.leftBtn setTitle:NSLocalizedStringFromTable(@"alert_view_new_album_delete", @"StringInfo", nil) forState:UIControlStateNormal];
            [self.leftBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
            [self.leftBtn addTarget:self action:@selector(startNewAlbum:) forControlEvents:UIControlEventTouchUpInside];
            self.leftBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
            [self.alertView setLeftBtn:self.leftBtn];
            [btn release];

posted @ 2014-08-08 09:48  如来藏  阅读(348)  评论(0编辑  收藏  举报