ios5

What is the difference between self.variable and self->variable?

孤街浪徒 提交于 2020-01-05 10:29:07
问题 I have seen accessing variable in iphone sdk with -> or . symbol.Which one is the best?what is the difference between self.variable and self->variable? 回答1: The dot-notation goes through the accessor, the arrow notation goes directly to the instance variable. Try this code: @interface Foo : NSObject @property(assign, nonatomic) NSInteger bar; @end @implementation Foo @synthesize bar; - (void) setBar: (NSInteger) newBar { NSLog(@"Setting new bar."); bar = newBar; } - (id) init { self = [super

iOS 5 simulator

。_饼干妹妹 提交于 2020-01-05 09:04:44
问题 I have xcode 4.2.1. The simulator works perfectly if I select the iOS 4.3 SDK but for some reason is not recognizing the folder containing the iOS 5.0 SDK. Some solution? Thanks 回答1: Xcode>preferences>downloads If for what ever reason your 5.0 simulator was removed this should allow you to re-add it. 回答2: My best advice is to upgrade your Xcode to Xcode 4.3. XCode 4.3 is the current stable version of Xcode and probably it'll fix you problem. It's odd to see this happening on Xcode 4.2.1 but I

Custom UIalertView in iOS5

醉酒当歌 提交于 2020-01-05 08:42:31
问题 Do anywho know a custom UIAlertView class what is working in iOS5 ? I'm looking for a class like TSAlertView, with that I will able to put 2 buttons stacked into alert. ( http://cocoacontrols.com/platforms/ios/controls/tsalertview ) Thanx for help. 回答1: UIAlertView in iOS 5 has UIAlertViewStyles UIAlertViewStyleDefault UIAlertViewStyleSecureTextInput UIAlertViewStylePlainTextInput UIAlertViewStyleLoginAndPasswordInput EDIT Sorry for misunderstanding your problem. The alert view shown in the

Updating cells with UIImageView to show currently selected item

半腔热情 提交于 2020-01-05 08:00:24
问题 I am using a sliding view controller which holds the main controller on top and a slide left menu controller. The controller on the left works as the menu like Facebook/Pintrest apps etc. It is a UITableView on the left. Here is my setup: cellForRowAtIndexPath static NSString *CellIdentifier = @"MainMenuCell"; UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle

iOS memory management - clarifications

好久不见. 提交于 2020-01-05 07:44:10
问题 I know that alloc and retain will increase the reference count of an object. Is there any other different method that actually increment the reference count? And when/how does dealloc is called? 回答1: With these the retain count gets increased. new, however it can be seen as alloc+init. retain copy creates new object with retain count=1 mutableCopy creates new object with retain count=1 dealloc is called automatically as soon as retain count reaches to 0. 回答2: alloc allocates an object with

Adding subview leaves gap between subview and navigation bar

亡梦爱人 提交于 2020-01-05 07:32:49
问题 I've got a storyboard with a view wrapped in a navigationcontroller, that has a UI tab bar at the bottom. I dynamically add sub views to this view, but there is always a blank line between the navigation bar and the subview that appears to be the width of a status bar. On each of the subviews that are created on the storyboard I have their Simulated Metrics set to have a bottom bar as a Tab Bar, status bar is set to none, and top bar is set to navigation bar. Below is my code for adding the

how to show only pin(annotation) title in map view?

谁说我不能喝 提交于 2020-01-05 05:49:06
问题 I have a Table view that has to push into map. I am trying to get the title from the annotation to show in the map view and I need to compare the value from subtitle value to show in map exactly based on annotation value, but I am getting in map is title and subtitle value. I don't want to show the subtitle but i want it to compare the values Here is my code: -(MKAnnotationView *)mapView:(MKMapView *)mV viewForAnnotation: (id <MKAnnotation>)annotation { MKAnnotationView *pinView = nil; if

handle taps in two different points at a same time via UIGestureRecognizer

走远了吗. 提交于 2020-01-05 04:56:34
问题 I have two labels in two different positions, when both labels are tapped at the same time i want another label to show a success message. How do I accomplish this? I can recognize a single tap or double tap with one or more finger touches but this is a different scenario. Please help. I tried this, but it does not work. UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)]; tapRecognizer.numberOfTapsRequired = 1;

NSArray vs NSDictionary look up

老子叫甜甜 提交于 2020-01-05 04:35:13
问题 Which is quicker and less expensive for checking if an object already exists within a list. By using the NSArray contains object or by checking if a key already exists for an NSDictionary? Also does the NSArray containObject selecter iterate through the whole array elements? Also what about checking if a key already exists within a dictionary? Does that require iterating through all the keys. Finally, what is the best and quickest way to check if an object already exists within a large list

how to specify height of row?

只愿长相守 提交于 2020-01-05 02:27:11
问题 I want to implement a tableview which shows an expandable cell for a specific row, so I create my custom table cell which will be expanded if setting its expandContent as following: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; NSString *shouldExpand = [self.datasource objectAtIndex:indexPath.row]; if(