Skip to content

Instantly share code, notes, and snippets.

View yeonsh's full-sized avatar

Seunghoon Yeon yeonsh

View GitHub Profile
@yeonsh
yeonsh / searchButtonPressed.m
Created April 5, 2011 13:38
searchButtonPressed
-(void) searchButtonPressed
{
[self.searchDisplayController setActive:YES animated:YES];
[self.searchDisplayController.searchBar becomeFirstResponder];
}
-(BOOL) setupFetchedResultsControllerForEntity:(NSString *)argEntityName withSortKey:(NSString *)argSortKey
{
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
// Configure the request's entity, and optionally its predicate.
NSEntityDescription *entityDescription = [NSEntityDescription entityForName:argEntityName inManagedObjectContext:self.managedObjectContext];
[fetchRequest setEntity:entityDescription];
@yeonsh
yeonsh / Capture OpenGL ES View as an Image
Created January 30, 2011 21:27
Capture OpenGL ES View as an Image
- (UIImage*)snapshot:(UIView*)eaglview
{
// Get the size of the backing CAEAGLLayer
GLint backingWidth, backingHeight;
glBindRenderbufferOES(GL_RENDERBUFFER_OES, _colorRenderbuffer);
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
NSInteger x = 0, y = 0, width = backingWidth, height = backingHeight;
NSInteger dataLength = width * height * 4;