Reputation: 1369
Actually I am converting an iPhone app to iPad.
For that I need to resize the "FONTS" of the labels.
There are many "title" called labels.
So, What I am doing now taking outlets of every label and setting the size of a font when the device is iPad.
There are too many labels so, 1) is there any way to set multiple outlets. to single instance so if I change one instance reflect to all?
2) is there any other method to change the size.
This is how my code looks like.
if([self isPad])
{
[btnReset.titleLabel setFont:BUTTON_FONT_iPAD_BOLD];
[btnViewReport.titleLabel setFont:BUTTON_FONT_iPAD_BOLD];
scrollView.contentSize = CGSizeMake(768,1200);
// scrollEmpView.contentSize = CGSizeMake(768, 1690);
//
// //Report View Page Frame Set
// //Values Before ADDED...
// [lblPayeCalculation setFont:LABEL_FONT_iPAD_REPORT];
// [lblTaxcode setFont:LABEL_FONT_iPAD_REPORT];
// [lblDeduct setFont:LABEL_FONT_iPAD_REPORT];
//
// [lblPayroll setFont:LABEL_FONT_iPAD_REPORT];
// [lblChild setFont:LABEL_FONT_iPAD_REPORT];
//
// [lblDate setFont:LABEL_FONT_iPAD_REPORT];
// [lblFrequency setFont:LABEL_FONT_iPAD_REPORT];
// [lblSalary setFont:LABEL_FONT_iPAD_REPORT];
//
// [lblGross setFont:LABEL_FONT_iPAD_REPORT];
// [lblEarnerLevy setFont:LABEL_FONT_iPAD_REPORT];
// [lblChildDeduct setFont:LABEL_FONT_iPAD_REPORT];
// [lblStudent setFont:LABEL_FONT_iPAD_REPORT];
//
// [lblKiwiDeduct setFont:LABEL_FONT_iPAD_REPORT];
// [lblTaxCredit setFont:LABEL_FONT_iPAD_REPORT];
// [lblNetPayment setFont:LABEL_FONT_iPAD_REPORT];
// [lblPayrollDonationAmt setFont:LABEL_FONT_iPAD_REPORT];
// [lblNetPaymentLessPayroll setFont:LABEL_FONT_iPAD_REPORT];
//
// [lblPayeCalculation setFont:LABEL_FONT_iPAD_REPORT];
//
//
//
// //Values Added...to only set it
//
// [lblQPaye setFont:LABEL_FONT_iPAD];
// [lblQPaye2 setFont:LABEL_FONT_iPAD_REPORT];
// [lblQP1 setFont:LABEL_FONT_iPAD_REPORT];
// [lblQP2 setFont:LABEL_FONT_iPAD_REPORT];
// [lblQP3 setFont:LABEL_FONT_iPAD_REPORT];
// [lblQP4 setFont:LABEL_FONT_iPAD_REPORT];
// [lblQPay setFont:LABEL_FONT_iPAD];
//
// [lblQPay1 setFont:LABEL_FONT_iPAD_REPORT];
// [lblQPay2 setFont:LABEL_FONT_iPAD_REPORT];
// [lblQPay3 setFont:LABEL_FONT_iPAD_REPORT];
// [lblQCalculation setFont:LABEL_FONT_iPAD];
// [lblQC1 setFont:LABEL_FONT_iPAD_REPORT];
// [lblQC2 setFont:LABEL_FONT_iPAD_REPORT];
// [lblQC2Sign setFont:LABEL_FONT_iPAD_REPORT];
// [lblQC3 setFont:LABEL_FONT_iPAD_REPORT];
// [lblQC3Sign setFont:LABEL_FONT_iPAD_REPORT];
// [lblQC4 setFont:LABEL_FONT_iPAD_REPORT];
// [lblQCSign4 setFont:LABEL_FONT_iPAD_REPORT];
// [lblQC5 setFont:LABEL_FONT_iPAD_REPORT];
// [lblQC5Sign setFont:LABEL_FONT_iPAD_REPORT];
// [lblQC6 setFont:LABEL_FONT_iPAD_REPORT];
// [lblQC6Sign setFont:LABEL_FONT_iPAD_REPORT];
// [lblQC7 setFont:LABEL_FONT_iPAD_REPORT];
// [lblQCSign setFont:LABEL_FONT_iPAD_REPORT];
// [lblQC8 setFont:LABEL_FONT_iPAD_REPORT];
// [lblQC8Sign setFont:LABEL_FONT_iPAD_REPORT];
// [lblQC9 setFont:LABEL_FONT_iPAD_REPORT];
// [lblQC9Sign setFont:LABEL_FONT_iPAD_REPORT];
// [lblQTitleKiwiSaver setFont:LABEL_FONT_iPAD];
//
// [lblQK1 setFont:LABEL_FONT_iPAD_REPORT];
// [lblKiwiContributePercent setFont:LABEL_FONT_iPAD_REPORT];
// [lblQK1 setFrame:YOFFSET_FRAME_iPAD(lblQK1, 10, -)];
//
// [lblQK2 setFont:LABEL_FONT_iPAD_REPORT];
// [lblKiwiContributeValue setFont:LABEL_FONT_iPAD_REPORT];
// [lblKiwiContributeValue setFrame:YOFFSET_FRAME_iPAD(lblKiwiContributeValue, 23, -)];
// [lblQK2 setFrame:YOFFSET_FRAME_iPAD(lblQK2, 29, -)];
//
// [lblQK3 setFont:LABEL_FONT_iPAD_REPORT];
// [lblKiwiCompulsoryValue setFont:LABEL_FONT_iPAD_REPORT];
// [lblQK3 setFrame:YOFFSET_FRAME_iPAD(lblQK3, 45, -)];
// [lblKiwiCompulsoryValue setFrame:YOFFSET_FRAME_iPAD(lblKiwiCompulsoryValue, 39, -)];
// [imgvLast setFrame:YOFFSET_FRAME_iPAD(imgvLast, 32, -)];
// [lblQKLast setFont:LABEL_FONT_iPAD];
}
Upvotes: 0
Views: 80
Reputation: 26400
If you are changing the fonts of all the labels within the view why not give this a try
if([self isPad])
{
[btnReset.titleLabel setFont:BUTTON_FONT_iPAD_BOLD];
[btnViewReport.titleLabel setFont:BUTTON_FONT_iPAD_BOLD];
scrollView.contentSize = CGSizeMake(768,1200);
for(UILabel *label in [self.view subviews]) {
if([label isKindOfClass:[UILabel class]])
label.font = LABEL_FONT_iPAD_REPORT;
}
}
Upvotes: 2
Reputation: 237060
Stuff them all in an array, then do [yourArray makeObjectsPerformSelector:@selector(setFont:) withObject:LABEL_FONT_iPAD_REPORT]
.
Upvotes: 1