- /*in my viewDidLoad in the details.m , the class containing the image and web view i am relying on viewDidLoad as follows : */
- - (void)viewDidLoad
- {
- // [self loadHtmlNewFontSize:sizeFontFromStepper];
- /* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
- /* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
- /* ---------------------------------------------------------------------------------------------------- IF the landscape mode is on loaded from the beginning !!!! ------------------------------------------------------------------------------------------------------ */
- /* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
- /* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
- if(LoadedRotated == YES){
- NSLog(@"The view is loaded rotated");
- Rot = YES;
- }
- /* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
- /* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
- /* ------------------------------------------------------------------------------------------------------------------------- IF the Portrait mode is on !!!! ----------------------------------------------------------------------------------------------------------- */
- /* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
- /* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
- NSLog(@"In the viewDidLoad this is the current value of the textFontSize %d" , textFontSize);
- if(Rot == NO){
- NewWidth2 = NewWidth;
- NewHeight2 = NewHeight;
- sizeFontFromStepper.minimumValue = 40;
- sizeFontFromStepper.maximumValue = 50;
- sizeFontFromStepper.value = 40;
- NSLog(@"The bool value of Rot is NO");
- NSString * htmlString = [NSString stringWithFormat:@"\
- <html>\
- <body>\
- <p style = 'font-size:40px;'> %@ <\p>\
- </body>\
- </html>",authorNAme];
- [self.WebV setScalesPageToFit:YES];
- [self.WebV loadHTMLString:htmlString baseURL:nil];
- NSString* extension = @"png";
- NSString* strRR = [NSString stringWithFormat:@"%@.%@", authorNAme2,extension];
- NSLog(@"This is the strRR variable %@ " , strRR);
- NSString *path = [[NSBundle mainBundle] bundlePath];
- //NSLog(@"This is the path %@", path);
- NSURL *baseURL = [NSURL fileURLWithPath:path];
- // NSLog(@"this is the base URL %@",baseURL);
- NSString *cachePath = [NSString stringWithFormat:@"%@/%@", path,strRR];
- NSLog(@"this is the cachPath variable %@" , cachePath);
- NSFileManager *fm = [NSFileManager defaultManager];
- NSLog(@"!!!!!!!!!!!!!!!!!!!!!!this is the image width %.6f and the image Height %.6f In the landscape mode !!!!!!!!!!!!!!!!!!!" , ImView.frame.size.width,ImView.frame.size.height);
- if(FirstLoad){
- ImView.frame = CGRectMake(150, 430, ImView.frame.size.width,ImView.frame.size.height);
- FirstLoad = NO;
- }
- else{
- ImView.frame = CGRectMake(150, 430, NewWidth,NewHeight);
- }
- if([fm fileExistsAtPath:cachePath])
- {
- ImView.image = [UIImage imageNamed:strRR];
- ImView.contentMode = UIViewContentModeScaleAspectFit;
- NSLog(@"file exists");
- // NSString * htmlString2 = [NSString stringWithFormat:@"<img src='%@' height='330' width='450' >" , strRR];
- // NSLog(@"This is the Strr %@ " , strRR );
- // WebV2.opaque = NO;
- // WebV2.backgroundColor = [UIColor clearColor];
- // [self.WebV2 loadHTMLString:htmlString2 baseURL:baseURL];
- // WebV3.backgroundColor = [UIColor whiteColor];
- }
- else
- {
- NSLog(@"file doest not exist");
- // NSString * htmlString2 = [NSString stringWithFormat:@"<img src='aa.png' height='330' width='450' >"];
- // WebV2.opaque = NO;
- // WebV2.backgroundColor = [UIColor clearColor];
- // [self.WebV2 loadHTMLString:htmlString2 baseURL:baseURL];
- // WebV3.backgroundColor = [UIColor whiteColor];
- // ImView.image = [UIImage imageNamed:@"aa.png"];
- //ll ImView.contentMode = UIViewContentModeScaleAspectFit;
- }
- }
- /* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
- /* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
- /* ------------------------------------------------------------------------------------------------------------------------- IF the landscape mode is on !!!! ----------------------------------------------------------------------------------------------------------- */
- /* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
- /* ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */
- else{
- sizeFontFromStepper.minimumValue = 25;
- sizeFontFromStepper.maximumValue = 35;
- sizeFontFromStepper.value = 25;
- NSLog(@"The bool value of Rot is YES");
- NSString * htmlString = [NSString stringWithFormat:@"\
- <html>\
- <body>\
- <p style = 'font-size:25px;'> %@ <\p>\
- </body>\
- </html>",authorNAme];
- [self.WebV setScalesPageToFit:YES];
- [self.WebV loadHTMLString:htmlString baseURL:nil];
- NSString* extension = @"png";
- NSString* strRR = [NSString stringWithFormat:@"%@.%@", authorNAme2,extension];
- NSLog(@"This is the strRR variable %@ " , strRR);
- NSString *path = [[NSBundle mainBundle] bundlePath];
- //NSLog(@"This is the path %@", path);
- NSURL *baseURL = [NSURL fileURLWithPath:path];
- // NSLog(@"this is the base URL %@",baseURL);
- NSString *cachePath = [NSString stringWithFormat:@"%@/%@", path,strRR];
- NSLog(@"this is the cachPath variable %@" , cachePath);
- NSFileManager *fm = [NSFileManager defaultManager];
- if([fm fileExistsAtPath:cachePath])
- {
- ImView.image = [UIImage imageNamed:strRR];
- ImView.contentMode = UIViewContentModeScaleAspectFit;
- NSLog(@"file exists");
- // NSString * htmlString2 = [NSString stringWithFormat:@"<img src='%@' height='330' width='450' >" , strRR];
- // NSLog(@"This is the Strr %@ " , strRR );
- // WebV2.opaque = NO;
- // WebV2.backgroundColor = [UIColor clearColor];
- // [self.WebV2 loadHTMLString:htmlString2 baseURL:baseURL];
- // WebV3.backgroundColor = [UIColor whiteColor];
- }
- else
- {
- NSLog(@"file does not exist");
- // NSString * htmlString2 = [NSString stringWithFormat:@"<img src='aa.png' height='330' width='450' >"];
- // WebV2.opaque = NO;
- // WebV2.backgroundColor = [UIColor clearColor];
- // [self.WebV2 loadHTMLString:htmlString2 baseURL:baseURL];
- // WebV3.backgroundColor = [UIColor whiteColor];
- // ImView.image = [UIImage imageNamed:@"aa.png"];
- // ImView.contentMode = UIViewContentModeScaleAspectFit;
- }
- // UIAlertView *messageAlert = [[UIAlertView alloc]
- // initWithTitle:@"New Width and height!" message:(@"This is the new value of width %.6u and height %.6u" , NewWidth, NewHeight) delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
- //
- // [messageAlert show];
- NSLog(@"!!!!!!!!!!!!!!!!!!!!!!this is the image width %.6f and the image Height %.6f In the landscape mode !!!!!!!!!!!!!!!!!!!" , ImView.frame.size.width,ImView.frame.size.height);
- ImView.frame = CGRectMake(280, 350, (NewWidth - (NewWidth /6)) ,(NewHeight - (NewHeight /6)));
- WebV.contentMode = UIViewContentModeScaleAspectFit;
- WebV.scalesPageToFit = YES;
- WebV.autoresizingMask = (UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth );
- // ImView.contentMode = UIViewContentModeScaleAspectFit;
- // ImView.autoresizingMask = ( UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth);
- //
- [super viewDidLoad];
- //textFontSize = sizeFontFromStepper.value;
- NSLog(@"this is the uistepper value %d", textFontSize);
- //self.labelText.text = authorNAme;text // NSInteger *fontSize = 100;
- }
- self.text2.text = authorNAme2;
- /* //////////////////////////////////////////// This is where the label text APPearsssssssss /////////////////////////// */
- NSLog(@"Everything is ok now !");
- }
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- /*And in the MyTabController.m class, the subclass that controls the rotation of tab bar controller*/
- BOOL LoadedRotated = NO;
- NSUInteger *cal = 0;
- -(void)viewDidLoad{
- // [self willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientationLandscapeRight) duration:1];
- }
- - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
- return YES;
- }
- - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration {
- if(interfaceOrientation == UIInterfaceOrientationPortrait){
- // interfaceOrientation = UIInterfaceOrientationPortrait;
- NSLog(@"Interface loaded in portrait mode");
- LoadedRotated = NO;
- Rot = NO;
- }
- if(interfaceOrientation == UIInterfaceOrientationLandscapeRight){
- // interfaceOrientation = UIInterfaceOrientationPortrait;
- if(cal == 0){
- LoadedRotated = YES;
- cal++;
- }
- Rot = YES;
- }
- if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft){
- Rot = YES;
- NSLog(@"This is the landscape left mode");
- }
- }