小编Min*_*arg的帖子

如何增加UIButton的选择范围?

我已经以UIButton编程方式完成了

togglebutton = [UIButton buttonWithType:UIButtonTypeCustom];
togglebutton.frame = CGRectMake(42, 15, 80, 21);
[togglebutton addTarget:self action:@selector(toggleview)   
forControlEvents:UIControlEventTouchUpInside];
[togglebutton setImage:[UIImage imageNamed:@"squ.png"] forState:UIControlStateNormal];
[buttonView addSubview:togglebutton];
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

它在上图中看起来是右键.现在的要求是该按钮的选择区域应该大于uibutton图像.这样用户就可以通过触摸特定按钮的区域来轻松点击按钮.

[togglebutton setImageEdgeInsets: UIEdgeInsetsMake( 0, -30, 0, -25)];
Run Code Online (Sandbox Code Playgroud)

我试图设置它image inset但它正在制作image irregular.请看这个问题.

objective-c uibutton ios

28
推荐指数
2
解决办法
3万
查看次数

获取nsdictionary中特定键的值

我将json解析结果保存在以下dictionary内容中:

{
 "statusCode":"200",
"body":[
  {
     "status":"success",
     "remarks":null
  }
],

"data":[
     "abcd":[
        {
           "category":"a",
           "title":"b",
           "id":"24"
        },
        {
           "category":"c",
           "title":"crd",
           "id":"65"
        },
        {
           "category":"ds",
           "title":"sd",
           "id":"18"
        }

     ]
  },
  {
     "efgh":[
        {
           "category":"ds",
           "title":"sd",
           "id":"18"
        },
        {
           "category":"sd",
           "title":"sd",
           "id":"1"
        }

                             ]
  },
  {
     "ijkl":[
        {
           "category":"ds",
           "title":"sd",
           "id":"18"
        },
        {
           "category":"sd",
           "title":"sd",
           "id":"1"
        }

     ]
  }
 ]
}
Run Code Online (Sandbox Code Playgroud)

key @"data"的数据可以通过使用保存到数组中

NSMutableArray *getdata=[[NSMutableArray alloc]init];
getcat=[results objectForKey:@"data"];
Run Code Online (Sandbox Code Playgroud)

现在我应该为values(category, title, id)第一个索引内部做些什么,即"abcd".

如果有人有任何知识,请看看.

谢谢大家.

iphone objective-c nsdictionary ios

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

从imageview点击手势获取索引或标记值

在此输入图像描述

每当我们搜索任何应用时,这都是来自应用商店的图片.我还想添加相同的scrollview概念,在其中显示currentntimage,并预览上一张和下一张图片.我可以在示例代码的帮助下创建此视图.但是没有找到任何解决方案,当用户点击任何图像时如何获得索引或标记值.这样我就可以打开每个图像的详细信息页面.如果有人对此有所了解,请帮助我.

提前致谢.

objective-c uiscrollview ios

14
推荐指数
2
解决办法
3万
查看次数

在iOS中为此应用评分

我使用iRate类添加'评价我的应用'功能.我添加了我的应用包ID.但是当我运行应用程序时,它会显示"无法连接到iTunes Store".请帮我找出问题.

这是我正在使用的代码:

-(void)applicationWillEnterForeground:(UIApplication *)application
{
    NSUserDefaults *times=[NSUserDefaults standardUserDefaults];
    int test=[[times objectForKey:@"time"]intValue];
    NSLog(@"test..:%d",test);
    if (test >=5) {

        [iRate sharedInstance].applicationBundleID = @"com.01Synergy";
        [iRate sharedInstance].onlyPromptIfLatestVersion = NO;

        //enable preview mode
        [iRate sharedInstance].previewMode = YES;
    }
}
- (void)applicationDidEnterBackground:(UIApplication *)application {

    NSUserDefaults *times=[NSUserDefaults standardUserDefaults];

    int time=[[times objectForKey:@"time"]intValue];

    if (time<5) {
        time++;
        [times setInteger:time forKey:@"time"];

    }

}
Run Code Online (Sandbox Code Playgroud)

objective-c ios

10
推荐指数
1
解决办法
7264
查看次数

iOS 6设置中的新Facebook帐户

我正在使用以下代码访问Facebook

 [FBSession openActiveSessionWithAllowLoginUI:TRUE];
 NSArray *permissions = [[NSArray alloc] initWithObjects:
                        @"email",
                        nil];
[FBSession openActiveSessionWithReadPermissions:permissions allowLoginUI:true    
completionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
    if (error) {
        NSLog(@"Failure");
    }
    else
        {

 }];
Run Code Online (Sandbox Code Playgroud)

当用户在iOS设置中启用了Facebook帐户时,以及在iOS设置中没有启用帐户时,它可以正常运行,然后进入safari进行facebook身份验证.但假设用户首先使用abcd@gmail.com启用了该帐户,并在一段时间后添加了新帐户,即efgh@gmail.com.那么应用程序如何知道用户在iOS设置中更改了他/她的帐户.如何使用facebook SDK进行检查.有人有想法吗?

谢谢大家.

facebook objective-c ios

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

ACAccountType始终显示0个帐户

我已经使用facebook SDK与facebook进行身份验证.如果在设置中没有启用Facebook帐户,则单击按钮应用程序将进入safari进行身份验证,即

if (appDelegate.session.state != FBSessionStateCreated)
    {
        appDelegate.session = [[FBSession alloc] init];
    }

    [appDelegate.session openWithCompletionHandler:^(FBSession *session,
                                                     FBSessionState status,
                                                     NSError *error) {
        // and here we make sure to update our UX according to the new session state
        [self updateView];
    }];
Run Code Online (Sandbox Code Playgroud)

否则,如果启用了Facebook帐户,那么

    NSArray *fbAccounts=nil;
    ACAccountType *accountTypeFB;
    if ((_accountStore = [[ACAccountStore alloc] init]) &&
        (accountTypeFB = [_accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook] ) ){
        fbAccounts = [_accountStore accountsWithAccountType:accountTypeFB];
        NSLog(@" %d fbAccounts",[fbAccounts count]);
    }
    if ([fbAccounts count]!=0) {

        [FBSession openActiveSessionWithAllowLoginUI:YES];
        NSArray *permissions = [[NSArray alloc] initWithObjects:
                                @"email", …
Run Code Online (Sandbox Code Playgroud)

facebook objective-c ios

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