小编Sal*_*har的帖子

iOS6 UIPickerView内存泄漏问题.

我得到了这个内存泄漏:

[UIPickerTableViewTitleCell initWithStyle:resuableIdentifier]; 
Run Code Online (Sandbox Code Playgroud)

NSConcentrateMutableAttributedString.
Run Code Online (Sandbox Code Playgroud)

问题是我没有实现这个委托.实现这一点后,内存泄漏就消失了.可能这些信息对其他人有用,因为我花了16个小时来解决这个问题.

// Do something with the selected row.
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view {

// Get the text of the row.
NSString *rowItem = [NSString stringWithFormat:@"     %@",[machineData objectAtIndex:row]];

// Create and init a new UILabel.
// We must set our label's width equal to our picker's width.
// We'll give the default height in each row.
UILabel *lblRow = [[UILabel alloc] initWithFrame:CGRectMake(0.0f, 0.0f, [pickerView bounds].size.width, 44.0f)];

// Make the text color red. …
Run Code Online (Sandbox Code Playgroud)

iphone memory-leaks objective-c uipickerview xcode4.5

6
推荐指数
1
解决办法
1388
查看次数