Kre*_*erg 3 objective-c format-specifiers ios
Format指定类型"unsigned long"但参数的类型为"int"
我在XCode中得到此错误,无论我放入什么格式说明符,或者如果我更改为NSInteger,NSUInteger,long或int,仍然会出错!?我怎样才能解决这个问题?
在
-(UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
Run Code Online (Sandbox Code Playgroud)
{
我有这些行,第2行是@"%lu"的错误,(行%max)
NSUInteger max = (NSInteger)[self.calendar maximumRangeOfUnit:NSCalendarUnitHour].length;
[lblDate setText:[NSString stringWithFormat:@"%lu",(row % max)]];
lblDate.textAlignment = NSTextAlignmentRight;
Run Code Online (Sandbox Code Playgroud)
感谢帮助 !
因为NSInteger你应该使用%td或%tu为NSUInteger
有关详细信息,请参阅此链接https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html
| 归档时间: |
|
| 查看次数: |
5500 次 |
| 最近记录: |