linphone-iphone/LiblinphoneTester/LogsView.m
Gautier Pelloux-Prayer 2c05f973c0 major mv
2015-09-09 16:44:00 +02:00

49 lines
1 KiB
Objective-C

//
// LogsViewController.m
// linphone
//
// Created by Guillaume BIENKOWSKI on 01/06/2014.
//
//
#import "LogsView.h"
#import "MasterView.h"
@interface LogsView () {
NSString *txt;
}
@end
@implementation LogsView
- (void)viewDidLoad {
[super viewDidLoad];
}
- (void)viewDidAppear:(BOOL)animated {
self.tview.textContainer.lineBreakMode = NSLineBreakByClipping;
self.tview.text = [lastLogs componentsJoinedByString:@"\n"];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(updateLogs:)
name:kLogsUpdateNotification
object:nil];
}
- (void)viewDidDisappear:(BOOL)animated {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (IBAction)clearLogs:(id)sender {
self.tview.text = nil;
}
- (void)updateLogs:(NSNotification *)notif {
NSArray *newLogs = [notif.userInfo objectForKey:@"newlogs"];
dispatch_async(dispatch_get_main_queue(), ^{
self.tview.text = [self.tview.text stringByAppendingString:[newLogs componentsJoinedByString:@"\n"]];
});
}
@end