Jump to content

6 posts in this topic

Recommended Posts

Posted

hey! so recenlty ive ran into a problem, im trying to add UILabels, and ive been adding them with addObject:BLAH BLAH BLAH, well it works on idevices newer than the iphone 5s but everything under crashes instantly! If anyone might know what the problem is off top of their head that would be sweet :) if not i can post the code :p thanks

 

skype - @kekigotrekt

kik - @a3t

 

or just respond here :p

Posted

addObject to what instance of a class, usually its addSubview to add to a UIView or a UIViewController

I think I did viewDidLoad and i put the UIabel in an NSArray

 

so it was -(NSArray *)generateSettingsOption

 

BLAH BLAH UI LABEL

Posted

hey! so recenlty ive ran into a problem, im trying to add UILabels, and ive been adding them with addObject:BLAH BLAH BLAH, well it works on idevices newer than the iphone 5s but everything under crashes instantly! If anyone might know what the problem is off top of their head that would be sweet :) if not i can post the code :p thanks

 

skype - @kekigotrekt

kik - @a3t

 

or just respond here :p

Post the code please :)
Posted

Post the code please :)

//code//

@interface SettingsOptionBase : NSObject
@property(nonatomic, retain) NSString *optionKey;
@property(nonatomic, retain) KESettingsViewController *KEManager;
@end


@interface SettingsOptionLabel : SettingsOptionBase
- (id)initWithHeight:(double)arg1 text:(id)arg2;
@end

//code//

%subclass KESettingsViewController : SettingsPane

- (void)loadView
{
  %orig;
  UIViewController *con = self.navigationController.previousViewController;

  if ([con isKindOfClass:%c(ProfileChatInfoViewController)])
  {
    ProfileChatInfoViewController *profVC = (ProfileChatInfoViewController *)con;
    self.username = profVC.user.username;
  }
}

- (void)viewDidLoad
{
  %orig;
  self.title = @"K8 Settings";
}

%new
- (NSString *)username
{
  return objc_getAssociatedObject(self, @selector(username));
}

%new
- (void)setUsername:(NSString *)value
{
  objc_setAssociatedObject(self, @selector(username), value, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}

%new
- (void)saveOption:(NSObject *)obj forKey:(NSString *)key
{
  saveOptionForKey(obj, key, self.username);
  [self reloadSettingsOptions];
}

%new
- (NSObject *)getOptionForKey:(NSString *)key
{
  return getOptionForKey(key, self.username);
}

- (id)initWithCore:(id)core
{
  self = %orig;
  self.username = kGlobalUser;
  // [self setup];
  return self;
}

%new
- (NSArray *)generateSettingsOptions
{
  NSArray *newArr =
  @[
  ];

  NSMutableArray *mutableNewArr = [NSMutableArray arrayWithArray:newArr];
  if (![self.username isEqualToString:kGlobalUser]) // not global
  {
    //code//
  }
  if ([self.username isEqualToString:kGlobalUser]) // global only
  {
    //code//
    [mutableNewArr addObject:[[[%c(SettingsOptionLabel) alloc] initWithHeight:90 text:
  @"test"] autorelease],
  }

  // [newArr addObject:[[%c(SettingsOptionSubPane) alloc] initWithTitle:@"Kik8 Options" iconImage:nil subPaneClass:%c(KESettingsViewController)]];

  return (NSArray *)mutableNewArr;
}

%new
- (void)dealloc
{
  // [self.tableView release];
  [self.username release];

  // [super dealloc];
}

%end

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...

Important Information

We would like to place cookies on your device to help make this website better. The website cannot give you the best user experience without cookies. You can accept or decline our cookies. You may also adjust your cookie settings. Privacy Policy - Guidelines