小编Abd*_*Ali的帖子

我们可以在后台启动iBeacon发射器吗?

我有一个iPhone应用程序,我在其中创建了一个发射器和一个接收器.但是,当屏幕锁定或应用程序被发送到后台时,发射器停止发送.

我还能在后台继续传输(又称广告,广播)吗?

iphone ios ibeacon

13
推荐指数
1
解决办法
4204
查看次数

如何从iOS中的字典中获取值

我是iOS新手.我创建了一个登录页面,一切正常.我使用JSON检查用户名和密码,并以字典格式从服务器获得响应.我想从字典中提取值并在我的程序中检查它们.我从服务器得到的响应是:

json: {
        error = 0;
        msg = "";
        value = {
                  user = false;
                };
      };
Run Code Online (Sandbox Code Playgroud)

首先,我想检查带键的值error是否为01.然后我想用密钥检查值user.我不知道应该如何编码来检查它.有人可以帮忙吗?

我试过的代码如下:

- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
    NSString *respString = [[NSString alloc] initWithData:loginJSONData encoding:NSUTF8StringEncoding];

    SBJsonParser *objSBJSONParser = [[SBJsonParser alloc] init];

    NSDictionary *json = [[NSDictionary alloc] initWithDictionary:[objSBJsonParser objectWithString:respString]];

    NSLog(@"json: %@",json);

    NSString *error = [json objectForKey:@"error"];

    NSLog(@"error: %@", error);

    if ([error isEqualToString:@"o"])
    {
        NSLog(@"login successful");
    }
    else
    {
        NSLog(@"login fail"); …
Run Code Online (Sandbox Code Playgroud)

json objective-c nsdictionary ios

12
推荐指数
3
解决办法
4万
查看次数

属性不可用:8.0之前的iOS版本的第一个基线布局属性

我在XCode 6.1中收到以下警告.

属性不可用:8.0之前的iOS版本的第一个基线布局属性

我想,这也导致我的iOS 7.x版本崩溃.

xcode ios autolayout ios7 ios8

11
推荐指数
1
解决办法
8816
查看次数

仅在输入后启用UIAlertAction的UIAlertAction

我使用的是UIAlertController提出了一个对话UITextField和一个UIAlertAction按钮标记为"好".如何将多个字符(例如5个字符)输入到UITextField?中,如何禁用该按钮?

objective-c uitextfield ios uialertcontroller

10
推荐指数
3
解决办法
7821
查看次数

需要打印信息[NSDate date]

当我打印日期时

//getting the current date and time
self.date = [NSDate date];
NSLog(@"%@",date);
Run Code Online (Sandbox Code Playgroud)

我得到的日期是正确的,但是时间延迟了6小时.我的系统时间是正确的.

nsdate ios

7
推荐指数
2
解决办法
9876
查看次数

如何在iOS中检查NSString中的NULL值?

我有一个NSString,我想检查它是否有NULL值.如果是,那么if条件应该执行.否则它应该执行else条件.

以下是我使用的代码:

if ([appDelegate.categoryName isEqual:[NSNull null]])
{
    select = [[NSString alloc] initWithFormat:@"select * FROM ContentMaster LEFT JOIN Category ON ContentMaster.CategoryID=Category.CategoryID where ContentMaster.ContentTagText='%@'", appDelegate.tagInput];
}
else
{
    select = [[NSString alloc] initWithFormat:@"select * FROM ContentMaster LEFT JOIN Category ON ContentMaster.CategoryID=Category.CategoryID LEFT JOIN Topic ON ContentMaster.TopicID=Topic.TopicID where ContentMaster.ContentTagText='%@' && Category.CategoryName='%@' && Topic.TopicName='%@'", appDelegate.tagInput, appDelegate.categoryName, appDelegate.topicName];
}    
Run Code Online (Sandbox Code Playgroud)

它总是执行else条件,而不是if条件,即使值是NULL.

null nsstring ios

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

在HTTPBody中设置NSDictionary并使用POST方法发送

我想用这个POST方法调用一个Web服务.我需要发布一个带有URL的字典.我的Web服务参数如下:

ConversationMessage {
       authorUserId (string, optional),
       subject (string, optional),
       hasAttachment (boolean, optional),
       conversationId (string, optional),
       attachment (DigitalAsset, optional),
       content (string, optional),
       title (string, optional),
       urgency (boolean, optional),
       searchable (Map[String,Object], optional)
}

DigitalAsset {
        id (string, optional),
        assetUrl (string, optional),
        assetContent (string, optional),
        thumbGenerated (boolean, optional),
        fileName (string, optional)
}  

Map[String,Object] {
        empty (boolean, optional)
}
Run Code Online (Sandbox Code Playgroud)

以下是我的要求:

    NSMutableArray *arr=[[NSMutableArray alloc]init];
    NSMutableDictionary *dict=[[NSMutableDictionary alloc]init];
    [dict setValue:@"test title" forKey:@"title"];
    [dict setValue:@"test message" forKey:@"content"];
    [dict setValue:@"0" forKey:@"urgency"];

    [arr addObject:[NSMutableDictionary dictionaryWithObject:dict forKey:@"ConversationMessage"]];

    NSMutableURLRequest …
Run Code Online (Sandbox Code Playgroud)

json objective-c nsmutableurlrequest ios

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

如何更改UISegmentedControl上文本的字体大小?

以下是初始化我的代码UISegmentedControl.

- (void)initializeToolButtons
{
    NSArray *buttonTitles = [NSArray arrayWithObjects:@"ANNEXET", @"HOVET", @"GLOBEN", "ALL", nil];

    toolbuttons = [[UISegmentedControl alloc] initWithItems:buttonTitles];
    toolbuttons.segmentedControlStyle = UISegmentedControlStyleBar;
    toolbuttons.tintColor = [UIColor darkGrayColor];
    toolbuttons.backgroundColor = [UIColor blackColor];     
    toolbuttons.frame = CGRectMake(0, 0, 320, 30);

    [toolbuttons addTarget:self action:@selector(toolButtonsAction) forControlEvents:UIControlEventValueChanged];

    [self.view addSubview:toolbuttons];
}
Run Code Online (Sandbox Code Playgroud)

如何减少每个项目的字体大小UISegmentedControl

注意: toolButtons已经在全球范围内声明.

size fonts uisegmentedcontrol ios

5
推荐指数
2
解决办法
9808
查看次数

UIView和UIViewController有什么区别?

我需要详细解释以下内容:

我们用什么用UIViewController?有什么用?

我有一个类似于以下的类:

class one
{
    UINavigationController *nav = ...;

    two *secondObject = ...;

    // By use of it, I have push the new view class two//ok
}
class two
{
 ...
}
Run Code Online (Sandbox Code Playgroud)

我怎么secondObject在课堂上使用one

从窗口开始的类层次结构是什么?

class composition uiviewcontroller uiview ios

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

在另一个UIViewController中显示UIViewController

我正在开发一个应用程序,其中UIViewController(firstViewController)包含some UILabels,a UIButton和a UIView(subView).在UIView应该显示UIViewController(secondViewController),其中包含一些层.我无法做到这一点.

我应该怎么做,以显示secondViewController子视图firstViewController

objective-c subview uiviewcontroller uiview ios

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

在UITableView中使用UITableViewCell

我对某些东西感到困惑.我正在尝试创建一个自定义单元格,我想使用界面生成器方式.

我创建表的正常方法是将表作为:

.H

@interface AssessList : UIViewController {

    IBOutlet UITableView *tblAssessList;
}

@property(nonatomic, retain) UITableView *tblAssessList;

@end
Run Code Online (Sandbox Code Playgroud)

.M

- (NSInteger)
numberOfSectionsInTableView:(UITableView *)tableView {
    return groupArray.count;
}


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
     return totalArray.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
    }



    cell.textLabel.text = @"I am the text....";

        return cell;
}
Run Code Online (Sandbox Code Playgroud)

现在我已经为单元格创建了一个新类,我想我知道如何将它放入.但是我可以将.h保留为

@interface AssessList : UIViewController
Run Code Online (Sandbox Code Playgroud)

或者带有完整表的类/ nib是否 …

iphone xcode uitableview ios

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