Display each item in an NSDictionary
Try this code for(NSString *key in [dict allKeys]) { NSLog(@”%@”,[dict objectForKey:key]); }
Try this code for(NSString *key in [dict allKeys]) { NSLog(@”%@”,[dict objectForKey:key]); }
Here’s what’s going on: The images you provide to the UIProgressView are basically being shoved in to UIImageViews, and the UIImageView is stretching the image to fill the space. If you simply do: [progressView setTrackImage:[UIImage imageNamed:@”track.png”]]; Then you’re going to get weird results, because it’s trying to stretch a 10px wide image to fill (for … Read more
Since in practice the NSText* returned by -currentEditor for an NSTextField is always an NSTextView*, I added the following code to my custom NSTextField subclass: -(BOOL) becomeFirstResponder { BOOL success = [super becomeFirstResponder]; if( success ) { // Strictly spoken, NSText (which currentEditor returns) doesn’t // implement setInsertionPointColor:, but it’s an NSTextView in practice. // … Read more
The sender should be the control which initiated the action. However, you should not assume its type and should instead leave it defined as an id. Instead, check for the object’s class in the actual method as follows: – (IBAction)onClick1:(id)sender { // Make sure it’s a UIButton if (![sender isKindOfClass:[UIButton class]]) return; NSString *title = … Read more
In your cellForRowAtIndexPath method add this code cell.imageView.userInteractionEnabled = YES; cell.imageView.tag = indexPath.row; UITapGestureRecognizer *tapped = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(myFunction:)]; tapped.numberOfTapsRequired = 1; [cell.imageView addGestureRecognizer:tapped]; [tapped release]; And then to check which imageView was clicked, check the flag in selector method -(void)myFunction :(id) sender { UITapGestureRecognizer *gesture = (UITapGestureRecognizer *) sender; NSLog(@”Tag = %d”, gesture.view.tag); … Read more