Dear scholars, code gurus.
My question is rather simple, I have been searching and trying for some time now without any luck, I would greatly appreciate some tiny help.
I have a simple class that should generate a view as following:
// vipcardclass.h
//
#import <UIKit/UIKit.h>
@interface vipcardclass : UIViewController {
}
+(IBAction)newsletter;
@end
and
// vipcardclass.m
#import "vipcardclass.h"
@implementation vipcardclass
+(IBAction)newsletter{
UIView *vipcard = [[UIView alloc] initWithFrame:CGRectMake(10.0, 0.0, 290.0, 280.0)];
UIImageView *vipcardBG = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"vip_card.png"]]; //background.png
[vipcard addSubview:vipcardBG];
CGRect webFrame = CGRectMake(6.0, 0.0, 300.0, 210.0);
UIWebView *content = [[UIWebView alloc] initWithFrame:webFrame];
[content setBackgroundColor:[UIColor clearColor]];
[content setOpaque:NO];
NSString *urlAddress = @"http://www.google.com";
NSURL *url = [NSURL URLWithString:urlAddress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[content loadRequest:requestObj];
[vipcard addSubview:content];
[content release];
[???????? addSubview:vipcard];
NSLog(@"Newsletter was called");
}
@end
(Kindly look at the ?????? , few lines above , if it was the main view controller I would use self.view addSubview: , My question is what is the proper syntax when using it from a class)
In my main view controller I #import "vipcardclass.h"
and at some point calling the class function [vipcardclass newsletter];
Which works just fine, apart from adding it to the main controller. I would add as a side note, that the class functionality is not communicating or relevant to any function in the main view controller, its a fire and forget thingy and I just want to open and display this view.
Thank you kindly.