小编Dev*_*ali的帖子

NSDate 中的时间/日期显示就像 iOS 中的消息和邮件应用程序一样

我正在构建一个应用程序,要求我显示时间和日期,即星期日(如果对象是在 24 小时之前创建的)等。就像 iOS 中的消息和邮件应用程序会显示 24 小时的时间,然后将其更改为显示“星期一”等日期,星期二......”。我正在寻找是否可以找到任何完全像这样的框架,或者我是否必须为此编写代码?

cocoa-touch nsdate ios

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

在Storyboard中以编程方式访问UIViewController

我正在开发一个具有多个ViewControllers的应用程序,并且有一个特定的ViewController"登录ViewController",我想从几乎每个UIViewController访问它,我知道我可以通过使用segue从每个控制器到LoginViewController实现这一点,我我肯定不是最好的解决方案,实现这一目标的最佳解决方案是什么?

iphone objective-c storyboard ios

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

XMPPFramework - 创建XMPPRoom

我一直在尝试使用下面提到的代码创建一个XMPPRoom,我已经在线查看了各种示例,但是当我使用此代码时,委托xmppRoomDidCreate或xmppRoomDidJoin委托不会被调用.我不确定我在这里做错了什么?

PS:xmppStream的代表被调用,它被连接并授权,但问题是XMPPRoom委托...

- (void)createChatRoom
{
    NSString *jabberID = @"abcxyz@testservice.com";
    self.xmppStream.hostName = @"testservice.com";


    self.xmppStream = [[XMPPStream alloc]init];
    [self.xmppStream addDelegate:self delegateQueue:dispatch_get_main_queue()];

    [self.xmppStream setMyJID:[XMPPJID jidWithString:jabberID]];

    NSError *error = nil;

    if (![self.xmppStream connectWithTimeout:XMPPStreamTimeoutNone error:&error]) {
        UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Error" message:[NSString stringWithFormat:@"Cannot connect to server %@",[error localizedDescription]] delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil];
        [alert show];

        return;
    }

    // Configure xmppRoom
    XMPPJID *roomJID = [XMPPJID jidWithString:@"TestRoom@conference.testservice.com"];

    XMPPRoomMemoryStorage *roomMemoryStorage = [[XMPPRoomMemoryStorage alloc] init];

    XMPPRoom *xmppRoom = [[XMPPRoom alloc] initWithRoomStorage:roomMemoryStorage
                                                           jid:roomJID
                                                 dispatchQueue:dispatch_get_main_queue()];

    [xmppRoom activate:self.xmppStream];
    [xmppRoom addDelegate:self delegateQueue:dispatch_get_main_queue()];
}
Run Code Online (Sandbox Code Playgroud)

xmpp objective-c ios xmppframework

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