Skip to content
Snippets Groups Projects
Commit 595e824b authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

reload content after saving so we re-highlight correctly

parent 46f043e0
No related branches found
No related tags found
No related merge requests found
...@@ -35,11 +35,16 @@ ...@@ -35,11 +35,16 @@
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
self.aboutView.delegate = self; self.aboutView.delegate = self;
self.aboutView.dataDetectorTypes = UIDataDetectorTypeNone; self.aboutView.dataDetectorTypes = UIDataDetectorTypeNone;
[self loadContent];
}
-(void)loadContent
{
UIColor *tintColor = self.view.tintColor; UIColor *tintColor = self.view.tintColor;
CGFloat red, green, blue, alpha; CGFloat red, green, blue, alpha;
[tintColor getRed: &red green: &green blue: &blue alpha: &alpha]; [tintColor getRed: &red green: &green blue: &blue alpha: &alpha];
int r = (int)(red*255), g = (int)(green*255), b = (int)(blue*255); int r = (int)(red*255), g = (int)(green*255), b = (int)(blue*255);
NSString *css = [NSString stringWithFormat:@"body { background-color: #FFFFFF; color: #252525; margin: 35px 10px 35px 10px; padding: 0; font-family: helvetica-neue,sans-serif; font-size: 1em; } b { font-weight: normal; color: rgb(%d,%d,%d); } a { color: rgb(%d,%d,%d); }", r, g, b, r, g, b]; NSString *css = [NSString stringWithFormat:@"body { background-color: #FFFFFF; color: #252525; margin: 35px 10px 35px 10px; padding: 0; font-family: helvetica-neue,sans-serif; font-size: 1em; } b { font-weight: normal; color: rgb(%d,%d,%d); } a { color: rgb(%d,%d,%d); }", r, g, b, r, g, b];
if([self.fileToEdit isEqual:@"About"]){ if([self.fileToEdit isEqual:@"About"]){
...@@ -73,9 +78,9 @@ ...@@ -73,9 +78,9 @@
UIBarButtonItem *save = [[UIBarButtonItem alloc] initWithTitle:@"Save" style:UIBarButtonItemStylePlain target:self action:@selector(saveFile)]; UIBarButtonItem *save = [[UIBarButtonItem alloc] initWithTitle:@"Save" style:UIBarButtonItemStylePlain target:self action:@selector(saveFile)];
[self.navigationItem setRightBarButtonItems:[NSArray arrayWithObjects: save, nil]]; [self.navigationItem setRightBarButtonItems:[NSArray arrayWithObjects: save, nil]];
} }
} }
-(void)saveFile -(void)saveFile
{ {
NSString *text = [self.aboutView stringByEvaluatingJavaScriptFromString: NSString *text = [self.aboutView stringByEvaluatingJavaScriptFromString:
...@@ -84,6 +89,7 @@ ...@@ -84,6 +89,7 @@
NSError *error; NSError *error;
[text writeToFile:self.fileToEdit atomically:YES [text writeToFile:self.fileToEdit atomically:YES
encoding:NSUTF8StringEncoding error:&error]; encoding:NSUTF8StringEncoding error:&error];
[self loadContent];
} }
- (void)didReceiveMemoryWarning - (void)didReceiveMemoryWarning
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment