- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
-(void) downloadTabWithTranspose
{
if (coreTextSupported) // всегда NO
{
return;
}
self.tabData = [self prepareChordsUrls:self.tabData];
}
// Парой сотней строк ниже
-(NSString *) prepareChordsUrls:(NSString *) source
{
NSString *regex = @"<font color=\"#.{6}\" class=\"chord\">(.*?)</font>";
NSMutableString *newHtml = [NSMutableString string];
NSRange range = NSMakeRange(0, 0);
int start = 0;
while (range.location != NSNotFound)
{
int location = range.location + range.length;
int length = [source length] - range.location - range.length;
range = NSMakeRange(location, length);
NSError *error = NULL;
range = [source rangeOfRegex:regex options:RKLNoOptions inRange:range capture:0 error:&error];
if (range.location != NSNotFound)
{
NSString *found = [source substringWithRange:range];
found = [found substringWithRange:[found rangeOfRegex:@"\\>(.*)\\<"]];
found = [found substringWithRange:NSMakeRange(1, [found length] - 2)];
[newHtml appendString:[source substringWithRange:NSMakeRange(start, range.location - start)]];
start = range.location + range.length;
[newHtml appendFormat:@"<a chord=\"%@\" href=\"chord:%@\">%@</a>", found, found, found];
}
}
[newHtml appendString:[source substringWithRange:NSMakeRange(start, [source length] - start)]];
return newHtml;
}
QuickNick 19.03.2012 15:09 # 0
Как же без Наблюдателя тут обойтись?
:)))
krypt 19.03.2012 15:11 # 0
krypt 19.03.2012 15:11 # 0
QuickNick 19.03.2012 15:17 # 0
krypt 19.03.2012 15:28 # 0
FAKYOUINTIRNEAT 20.03.2012 12:17 # 0
krypt 20.03.2012 13:37 # 0