我有一个回调方法,我必须工作,但我想知道如何传递值.
我有的是这个:
@interface DataAccessor : NSObject
{
void (^_completionHandler)(Account *someParameter);
}
- (void) signInAccount:(void(^)(Account *))handler;
Run Code Online (Sandbox Code Playgroud)
上面的代码有效,但我想将值传递给方法.这看起来怎么样?就像是:
- (void) signInAccount:(void(^)(Account *))handler user:(NSString *) userName pass:(NSString *) passWord;
Run Code Online (Sandbox Code Playgroud)
?
我的mapview工作正常,但放在地图上的图钉标题为美国.我该如何更改此标题?
MKCoordinateRegion thisRegion = {{0.0,0.0}, {0.0,0.0}};
thisRegion.center.latitude = 22.569722;
thisRegion.center.longitude = 88.369722;
CLLocationCoordinate2D coordinate;
coordinate.latitude = 22.569722;
coordinate.longitude = 88.369722;
thisRegion.center = coordinate;
MKPlacemark *mPlacemark = [[[MKPlacemark alloc] initWithCoordinate:coordinate addressDictionary:nil] autorelease];
[mapView addAnnotation:mPlacemark];
[mapView setRegion:thisRegion animated:YES];
Run Code Online (Sandbox Code Playgroud) 我搜索过,找不到这个答案......
如果我有这个,我怎么能让它显示最终的%符号?它只是在我的标签中省略了它.
[NSString stringWithFormat:@"Tries %i%", tries];
Run Code Online (Sandbox Code Playgroud) 我已将自定义字体添加到我的资源并捆绑资源以及我的plist.在iOS5中一切正常,但是当我尝试iOS 4.3模拟器时,没有任何自定义字体可以工作.
知道为什么吗?
以下是我访问字体的示例:
lblWait.font = [UIFont fontWithName:@"AvenirNextLTPro-Medium" size:22];
Run Code Online (Sandbox Code Playgroud) 在iOS5中,这很好用:
[descriptionWebView.scrollView setScrollEnabled:NO];
Run Code Online (Sandbox Code Playgroud)
但是在任何低于5的iOS中它都失败了:
[UIWebView scrollView]: unrecognized selector sent to instance 0x791f9e0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIWebView scrollView]: unrecognized selector sent to instance 0x791f9e0'
Run Code Online (Sandbox Code Playgroud) ios ×4
callback ×1
methods ×1
mkmapview ×1
mkplacemark ×1
nsstring ×1
objective-c ×1
title ×1
uifont ×1
uikit ×1
uiscrollview ×1
uiwebview ×1