我想在其中画一个带有数字的圆圈:
-(void)drawRect:(CGRect)rect {
//Drawing code
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetLineWidth(context, 4.0);
CGContextSetStrokeColorWithColor(context, [UIColor blackColor].CGColor);
CGContextBeginPath(context);
CGContextAddEllipseInRect(context, rect);
CGContextDrawPath(context, kCGPathFillStroke);
// Label and index code
UILabel* circleLabel = [[UILabel alloc] init];
NSString *i=[Index stringValue];
[circleLabel setText:i];
[self addSubview:circleLabel];
}
Run Code Online (Sandbox Code Playgroud)
我从我自己的方法调用drawRect方法:
-(void)addPhotoIndex:(NSNumber*)tempNumber withCoordinate:(NSString*)currentTouchPos{
self.coord= CGPointFromString(currentTouchPos);
CGRect rect= CGRectMake ((coord.x - 5), (coord.y- 5), 5, 5);
NSNumber *Index= tempNumber;
[self drawRect:rect];
}
Run Code Online (Sandbox Code Playgroud)
它本身是从ViewController调用的.
但这并不是什么都没有,也没有任何错误.有人可以帮帮我吗?
解:
最后,这是它的工作原理:
-(void)addPhotoIndex:(NSNumber*)tempNumber withCoordinate:(NSString*)currentTouchPos{
self.coord= CGPointFromString(currentTouchPos);
CGRect rect= CGRectMake ((coord.x - 3), (coord.y- 3), 3, 3);
NSNumber *Index= tempNumber; …Run Code Online (Sandbox Code Playgroud) 我在我的应用程序中集成了面向android v3.5的Facebook SDK,并包含了安装发布代码:
com.facebook.AppEventsLogger.activateApp(this);
Run Code Online (Sandbox Code Playgroud)
但我收到了很多由以下原因引起的崩溃:
Settings.java line 418
com.facebook.Settings.getAttributionId
Run Code Online (Sandbox Code Playgroud)
而它正在抛出异常:
java.lang.IllegalStateException: Orca SharedPreferences used before initialized
Run Code Online (Sandbox Code Playgroud)
我一直试图重现崩溃但没有成功.有人遇到过这个问题吗?我只是想知道:
/* Only activate FaceBook publish install if the user has the FaceBook app installed */
if (com.facebook.Settings.getAttributionId(getContentResolver()) != null){
com.facebook.AppEventsLogger.activateApp(this);
}
Run Code Online (Sandbox Code Playgroud)
这会解决问题吗?谢谢!
我安装了适用于iOS的google + SDK并实现了共享功能:
- (void)customUIASView:(CustomUIASView *)customUIASView didClickGoogle:(UIButton *)sender{
static NSString * const kClientId = @"122385832599-2mcvobo565un3ab7d6d06m6fjemocto9.apps.googleusercontent.com";
share = [[GPPShare alloc] initWithClientID:kClientId];
share.delegate = self;
[[[[share shareDialog]
setURLToShare:[NSURL URLWithString:myUrl]]
setPrefillText:oPin.sName] open];
}
Run Code Online (Sandbox Code Playgroud)
一切正常,控制台没有错误,但是当使用此链接打开Safari手机时(适用于所有桌面浏览器),我收到404错误!
有人有同样的错误:https://groups.google.com/forum/#! msg/google-plus-Developers/ZSCxGNTqRJY / jidPJ076BfYJ
但解决方案是将BundleID更改为另一个至少有一个点.我的bundleId已经有两个点,所以我不知道该怎么做.有没有人知道如何解决这个问题?谢谢!
我想在显示视图时向父视图上显示的子视图添加两个按钮.按钮被正确初始化并显示,但按下时它们没有反应.有人知道为什么吗?这是我的代码:
-(void) viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
self.view.backgroundColor = [UIColor blackColor];
//Animation View
imageView= [[UIImageView alloc] initWithFrame:CGRectMake(0, 499, 320, 0)];
imageView.image = [UIImage imageNamed:@"trans.png"];
[imageView setClipsToBounds:YES];
[imageView setContentMode:UIViewContentModeBottom];
[self.view addSubview:imageView];
[UIView animateWithDuration:1.0f
delay:0.5f
options:UIViewAnimationOptionCurveEaseOut
animations:^(void) {
imageView.frame = CGRectMake(0, 92, 320, 320);
}
completion:NULL];
[self.view bringSubviewToFront:imageView];
// Animation View Buttons
//1 Amazon
UIButton *button1 = [UIButton buttonWithType:UIButtonTypeCustom];
UIImage *button=[UIImage imageNamed:@"button.png"];
[button1 setImage:button forState:UIControlStateNormal];
button1.frame = CGRectMake(0, 290, 80, 30);
button1.backgroundColor=[UIColor whiteColor];
button1.showsTouchWhenHighlighted=YES;
[button1 addTarget:self
action:@selector(openAmazon:)
forControlEvents:UIControlEventTouchUpInside];
[imageView addSubview:button1];
//2 iTunes
UIButton *button2 …Run Code Online (Sandbox Code Playgroud)