Peer Display Name

It is often useful to display the name of the peer you are connected to. Referring to Figure 10.1, the navigation bar contains a title that references the connected user; this is done using the following code snippet:

NSString *peerDisplayName = [self.currentSession displayNameForPeer: self.peerID];[[self navigationItem] setTitle: [NSString stringWithFormat:@"Chat with %@", peerDisplayName]];

Get iOS Components and Frameworks: Understanding the Advanced Features of the iOS SDK now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.