小编ros*_*ino的帖子

CGContextAddEllipseInRect不绘制任何内容

我想在其中画一个带有数字的圆圈:

   -(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)

objective-c

8
推荐指数
1
解决办法
3301
查看次数

java.lang.IllegalStateException:初始化之前使用的Orca SharedPreferences

我在我的应用程序中集成了面向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)

这会解决问题吗?谢谢!

java android orca sharedpreferences facebook-sdk-3.0

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

尝试与我的自定义iOS应用分享Google+时出现404错误

我安装了适用于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://plus.google.com/share?client_id=122385832599-2mcvobo565un3ab7d6d06m6fjemocto9.apps.googleusercontent.com&continue=com.pinstyle.pinstyle%3A%2F%2Fshare%2F&text=NEU%20H%26M%20Divided%20Grey%20blogger% 20Trend%20urban%20Leder%20Biker%20Jacke%20Nieten%2034%20S%20XS%2036&URL = HTTP%3A%2F%2Fpinboard.maryme.lan.s3.amazonaws.com%2F1%2F25607-neuhmdividedgreybloggertrendurbanlederbikerjackenieten34sxs36.jpg&bundle_ID的= com.pinstyle. pinstyle&gpsdk = 1.0.0

有人有同样的错误:https://groups.google.com/forum/#! msg/google-plus-Developers/ZSCxGNTqRJY / jidPJ076BfYJ

但解决方案是将BundleID更改为另一个至少有一个点.我的bundleId已经有两个点,所以我不知道该怎么做.有没有人知道如何解决这个问题?谢谢!

share objective-c http-status-code-404 ios google-plus

5
推荐指数
1
解决办法
722
查看次数

UIButton没有处理动画子视图

我想在显示视图时向父视图上显示的子视图添加两个按钮.按钮被正确初始化并显示,但按下时它们没有反应.有人知道为什么吗?这是我的代码:

-(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)

objective-c uibutton uiviewanimation

0
推荐指数
1
解决办法
1103
查看次数