Skip to content

Instantly share code, notes, and snippets.

View amro's full-sized avatar

Amro Mousa amro

View GitHub Profile
var foo = ["blah", "hi", "bar"];
for (int i = 0; i < foo.length(); i++) {
alert(foo[i]);
}
@amro
amro / gist:934904
Created April 21, 2011 16:22
Dynamic UITabelViewCell Height Based on String
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *string = [array objectAtIndex:indexPath.row];
CGSize suggestedSize = [string sizeWithFont:[UIFont systemFontOfSize:15.0]
constrainedToSize:CGSizeMake(224.0, FLT_MAX)
lineBreakMode:UILineBreakModeWordWrap];
return suggestedSize.height + 40; // add 40px for padding
}
//In this example all three run
if (...) {
}
if (...) {
}
if (...) {
}
<html>
<body>
<script type="text/javascript">
var numbers = new Array();
numbers[0] = "1";
numbers[1] = "1";