[Solved] How to refer to an array? [closed]

You shouldn’t need an array of points, at least not in this case. A center can only be one point: self.center = CGPointMake(10,10); The first integer is the x coordinate and the second is the y. Update: If I understand your question in the comments, you can do this: for (int i = 0; i … Read more

[Solved] Understanding a method from objective-c [closed]

In this method a is the parameter of class StockHolding. So when passing parameter to the method, always * symbol followed by class. So that it will typecast to the object accordingly. For example below:- This is the NSString class method:- + (id)stringWithString:(NSString *)aString In this aString is the parameter whose type refers to NSString … Read more

[Solved] All NSUserDefaults, all in tableview

You can set an array to userDefaults, the implementation is very simple. – (void)viewDidLoad { [super viewDidLoad]; [self addTextToUserDefaults:@”hello”]; [self addTextToUserDefaults:@”how are you?”]; [self addTextToUserDefaults:@”hi”]; for (NSString *text in [self textsInUserDefaults]) { NSLog(@”%@”, text); } } – (void)addTextToUserDefaults:(NSString *)aText { NSMutableArray *texts = [[[NSUserDefaults standardUserDefaults] objectForKey:@”textArray”] mutableCopy]; if (!texts) { texts = [NSMutableArray new]; } … Read more

[Solved] UIWebview loads with blank page [closed]

I resolved this issue, error in this below line destViewController.path = [documentsDirectory stringByAppendingPathComponent:[dirFiles objectAtIndex:indexPath.row]]; replaced it with below line destViewController.path = [inboxPath stringByAppendingPathComponent:[dirFiles objectAtIndex:indexPath.row]]; solved UIWebview loads with blank page [closed]

[Solved] What are some different ways of making an effective email validation method without using regular expression in objective c?

my attempt @interface Tester : NSObject +(BOOL) testForValidMail:(NSString *)mail; @end @implementation Tester +(BOOL)testForValidMail:(NSString *)string { NSRange atRange = [string rangeOfString:@”@”]; BOOL b = NO; if ((atRange.location != NSNotFound) //is `@` present && (atRange.location != 0) // and is `@` not at the beginning -> left substring exist && (atRange.location != string.length-1) // and not at … Read more

[Solved] Get the trim value from the double value

So basically you want to round a number up. ceilf is what you want, it will return a float so you want to use that to one decimal place. NSLog(@”ceilf %.1f”, ceilf(1.23456)); 2015-03-06 14:42:39.537 [xxxx] ceilf 2.0 1 solved Get the trim value from the double value

[Solved] objective-c index in an Array [closed]

Remove these lines: [acat addObject:@”cat1″]; [acat addObject:@”cat2″]; [acat addObject:@”cat3″]; [acat addObject:@”cat4″]; Declare your array and NSURL not in viewDidLoad, Do this instead in your .h: @interface AZViewController : UIViewController { NSInteger _acatindex; NSMutableArray *acat; NSURL *url; } @property (weak, nonatomic) NSMutableArray *acat; – (IBAction)catbutt:(id)sender; Now cut the following code from viewDidLoad(): url = [[NSBundle mainBundle] … Read more

[Solved] How can I decode an NSString using the A1Z26 cipher? [closed]

In Objective C this can be done as follows: -(NSString *)decode:(NSString *)input { NSArray<NSString *> *components = [input componentsSeparatedByString:@”-“]; NSMutableString *output = [[NSMutableString alloc] init]; for (NSString *component in components) { if (component.length == 0) { continue; } char charValue = (char) [component intValue]; [output appendFormat:@”%c”, charValue + (‘a’ – 1)]; } return [NSString stringWithString:output]; … Read more

[Solved] how can I Convert NSMUtableArray to NSString [closed]

As per Hot Licks comment you can use below code. bookArray = [[NSMutableArray alloc] init]; [bookArray addObject:@”Book A”]; [bookArray addObject:@”Book B”]; Then use Below code. NSString *yourString=[bookArray description]; if you want to use NSMutableString and Some different separator then use Below Code. NSMutableString* content = [NSMutableString string]; for (int aa=0; aa < [bookArray count]; aa++){ … Read more

[Solved] -[__NSCFDictionary objectAtIndex:]: unrecognized selector sent to instance [duplicate]

NSArray *retrievedJTrans = [NSJSONSerialization JSONObjectWithData:response options:0 error:&jsonParsingError]; is a dictionary what you might want NSDictionary *retrievedJTransD = [NSJSONSerialization JSONObjectWithData:response options:0 error:&jsonParsingError]; NSArray *retrievedJTrans = retrievedJTransD[@”data”][@”translations”]; 0 solved -[__NSCFDictionary objectAtIndex:]: unrecognized selector sent to instance [duplicate]

[Solved] Can’t see the button

Simple remove self.myView.hidden = YES; To add you click listener, two solution: By code in your viewDidLoad: – (void)viewDidLoad { [super viewDidLoad]; [mybutton addTarget:self action:@selector(myButtonClick:) forControlEvents:(UIControlEvents)UIControlEventTouchDown]; } – (void)myButtonClick:(id)sender { myButton.hidden = YES; } Or via interface Builder (preferred), The easiest way is to actually define the handler/action in Xcode using the IBAction declaration in … Read more