Search Results

Search found 1119 results on 45 pages for 'tableview'.

Page 6/45 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • IPhone Plain TableView Section Header Image and Getting Text on Two Lines

    - by jp
    Hello, this is my first question, so if I didn't do the tags correctly, I'm sorry. I tried... Well here is my question: I am hoping someone can tell me how to do a 2-line section header for a plain tableview. The problems I am having are: 1) I cannot find an image that will mimic that of the default 1-line section header. Can someone share one with me, or tell me how I can find one? 2) I cannot seem to get the section header text on two lines, since I am pulling it from the fetched results controller, a "field" (sorry if wrong terminology) that I custom defined on the class for my table. So this "field" has multiple field values in it, and I have no way to take them apart... Any help would be appreciated.

    Read the article

  • Getting Tap/Touch Position when selecting a TableView cell

    - by Omer
    Hi, hope to get some help here because this is something that really makes me mad... I have a view with a tableView, and when I tap a cell I want to present a popOver window pointing the arrow to the cell I tapped. the things that I think I need is: 1- the position of the cell in the screen (not in the view, because on large tables the Y value of the cell's rect could be grater than screen hight) or 2- a CGPoint or something similar that represents the point in the screen I tapped. I can't figured this out, and makes me really mad!!! Any help will very very very very usefull. Have a nice day.

    Read the article

  • Tableview lags, and glitches while scrolling due to images loading in each cell

    - by Luis Tovar
    Hey Guys! Me again! Can someone provide me with some example code of how to properly load images in a tablecell without making the tableview glitch while scrolling. For example if you look at fandago's app, when scrolling through their movies you can see that the image is loaded asynchronously so that the scroll isnt jumping, lagging, or glitchy. Thanks in advance. Right now I have the images loading just fine but it is glitchy as i scroll because the images are loading on main thread. I am creating an app very similar to fandango. PS I am downloading these images via xml. (you know what i mean) Thanks!!

    Read the article

  • Table View rotate, but not properly (shape change)

    - by Pencrace
    Hello everyone, Here is the thing. I have a ViewController which contain a view in full window. And the program run in landscape mode. I want to put an UITableView over the full screen view but only on right half part of the screen. So I add a UITableView in my view controller, I used the Interface Builder in order to set the Table View in the upper half of the screen so It will be on the right part in LandscapeLeft mode. I searched for on a lot of forum how to rotate my Table View. And so it does... except, It get stuck on the upper half of the landscape mode, it should stick on the right half. I'm not a iPhone coder since long, so I'm a bit confused on how to solve this problem. Do you have any idea on how to resize or make the TableView rotate properly. Thanks,

    Read the article

  • TableView - iVar reset when returning from details view

    - by iFloh
    Hi, anyone knows what I need to do to retain my TableView iVars whilst pushing a details view onto the navigation stack? I have an array and a date defined as iVars and the array is retained, whilst the date is not. I checked whether there may be an autorelease hidden somewhere but there are no obvious ones. The properties are defined as nonatomic, retain. I use custom NSDate category methods to determine specific dates at stages. These use NSDateComponents, NSRange and NSCalendar, for example: - (NSDate *)lastDayOfMonth: { NSCalendar *tmpCal = [NSCalendar currentCalendar]; NSDateComponents *tmpDateComponents = [tmpCal components:NSYearCalendarUnit | NSMonthCalendarUnit | NSEraCalendarUnit | NSWeekCalendarUnit | NSWeekdayOrdinalCalendarUnit fromDate:self]; NSRange tmpRange = [tmpCal rangeOfUnit:NSDayCalendarUnit inUnit:NSMonthCalendarUnit forDate:[tmpCal dateFromComponents:tmpDateComponents]]; [tmpDateComponents setDay:tmpRange.length]; [tmpDateComponents setHour:23]; [tmpDateComponents setMinute:59]; [tmpDateComponents setSecond:59]; return [[NSCalendar currentCalendar] dateFromComponents:tmpDateComponents]; } could they somehow be the reason?

    Read the article

  • Detect second tap on tableview cell iphone sdk

    - by neha
    Hi all, In my application, I'm expanding a tableview row when it's tapped. I'm using - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; if( selected == YES ) { [self expandRow]; } else { [self contractRow]; } height = [lblFeed frame].size.height + 75; } to achieve that. So when a row is tapped, this function automatically gets the signal of row tap and it sets the selected=YES. Now when I tap the same expanded row, it still sets selected=YES. I want to detect the second tap and contract the row. How shall I do that while using the same function?

    Read the article

  • fixed-size tableView cell in iPhone?

    - by SeniorLee
    I want to have all same size(width) cells in tableView no matter what accessory they have. If text in a cell almost fits to a cell, If i click that cell, check mark(accessory at the right) is displayed and some of characters goes to next line. it's annyoing. It's ok to do wordwrap. I can adjust cell's height. But I dont' want a cell displays different number of characters in an line depends on it's clicked or not. How can I do that?? thanks.

    Read the article

  • Load different views depending on the category of data on tap of tableview cell iPhone sdk

    - by neha
    Hi all, In my aplication, I want a tableview with different cell structure depending upon the category of data that's getting loaded in it [I have different categories like video, editorial etc with different structure of data like video has a single label, editorial has 3 labels etc]. I can load different nib files based on the data coming from xml parser. Now when the cell is tapped, I want to show its detailed view on a new viewController. So my question is is it possible to use only 1 viewController show different fields depending upon the category of data in the cell. Or do I need to create different viewControllers for each of the categories?

    Read the article

  • Tableview with sections managed by fetched results controller

    - by Matthes
    Hi, I'm quite new to CoreData and need help with one issue. I have tableview which simply lists cities stored in SQLite db. City is defined by "cityId" and "name" attributes. Data are fetched using NSFetchedResultsController and everything works fine except that I can't figure out how to make FetchedResultsController to group cities by first letter of city names. When I supply "name" for sectionNameKeyPath argument of initWithFetchRequest:managedObjectContext:sectionNameKeyPath:cacheName: method, it creates section for each city, which is obviously something I don't want. I can't figure out how to create an expression which would make it work in way I need. thanks for any tips and/or advices on this Matthes

    Read the article

  • Edit Mode Delete Spinner Icon for Specific TableView Rows

    - by Michael Bordelon
    I have a grouped tableview. Each section has three rows. I need to be able to delete one section at a time. Using the standard edit mode, I can make it work. However, the delete icon shows up to the left of each cell, not just the first row in each section. Is there a way to suppress the little spinner icon for all rows except the first? I am hoping there is an easy way to do this without subclassing. Thanks for your help. Here is a screenshot to help visualize it: http://picasaweb.google.com/lh/photo/ll-EJY5ACw7oqHH1xKBQ8w?feat=directlink

    Read the article

  • Is this a tableView issue or a CoreData Issue

    - by monotreme
    I have a CoreData-driven navigation app and I'm trying to figure out why It's crashing. I've got a hierarchy which is 3 view Controllers deep, all related by coredata relatioships, like this. TableViewA =relationship= TableViewB =relationship= TableViewC I'm honestly a novice at core data and I think my problem lies in the fetched results controller. I have one in TableViewA and another in TableViewB, and no matter how deep I go, the console always cites TableViewB's fetched results controller methods after a crash. Is this the problem? What's happening specifically is if I launch my app and drill down into the hierarchy of one record, let's call it Record1, I can delete sub records to my hearts content. Gone! no problem! But the second I go back to TableViewA and drill down into a different record, let's call that one Record2, and try to delete it's subrecords my app crashes, with the console citing this code from TableViewB as the problem. - (void)controllerWillChangeContent:(NSFetchedResultsController *)controller { // The fetch controller is about to start sending change notifications, so prepare the table view for updates. [self.tableView beginUpdates]; } When I go into the debugger, the specific method it always has a problem with is: if (![x.managedObjectContext save:&error]) { NSLog(@"Unresolved error %@, %@", error, [error userInfo]); abort(); } Just a confirmation of my idiocy with CoreData is all I'm looking for I think. Oh and how many ManagedObjectContexts should I have in an app of this type. I've been told I should have separate ones for adding content, which then should re-integrate into the main one. Is this true? Thanks!

    Read the article

  • Custom UITableviewcell, CGGradient still shows when cell is selected?

    - by Burnsoft Ltd
    I'm using a custom tableview cell (like Tweetie's fast scrolling) i've added a gradient to the context, which looks really nice, but when I select the cell, the gradient is still visible. I'm not sure how to go about removing the gradient when the cell is selected? any ideas? cheers Nik - (void)drawContentView:(CGRect)r { CGContextRef context = UIGraphicsGetCurrentContext(); UIColor *backgroundColor = [UIColor whiteColor]; UIColor *textColor = [UIColor blackColor]; UIColor *dateColor = [UIColor colorWithRed:77.f/255.f green:103.f/255.f blue:155.f/255.f alpha:1]; if(self.selected) { backgroundColor = [UIColor clearColor]; textColor = [UIColor whiteColor]; } [backgroundColor set]; CGContextFillRect(context, r); //add gradient CGGradientRef myGradient; CGColorSpaceRef myColorspace; size_t num_locations = 2; CGFloat locations[2] = {0.0, 1.0}; CGFloat components[8] = {0.9f, 0.9f, 0.9f, 0.7f, // Bottom Colour: Red, Green, Blue, Alpha. 1.0f, 1.0f, 1.0f, 1.0}; // Top Colour: Red, Green, Blue, Alpha. myColorspace = CGColorSpaceCreateDeviceRGB(); myGradient = CGGradientCreateWithColorComponents (myColorspace, components, locations, num_locations); CGColorSpaceRelease(myColorspace); CGPoint startPoint, endPoint; startPoint.x = 0; startPoint.y = self.frame.size.height; endPoint.x = 0; endPoint.y = self.frame.size.height-15; // just keep the gradient static size, never mind how big the cell is CGContextDrawLinearGradient (context, myGradient, startPoint, endPoint, 0); CGGradientRelease(myGradient); //gradient end //rest of custom drawing goes here.... } Should I be doing something in the if cell selected code?

    Read the article

  • App crashes every second time a tableview row is selected in navigation controller setup

    - by Thaurin
    Disclaimer first: I'm pretty new to Objective-C and the retain model. I've been developing in a garbage collected .NET environment for the last five years, so I've been spoiled. I'm still learning. I'm having my iPhone app crash with EXC_BAD_ACCESS. It happens in a navigtation controller/tableview setup. When I select a row the first time, no problems. It switches in the child controller without problems. I go back and select the same row again. Program then proceeds to crash. Every other row works fine, but every second time a row is accessed, it's a crash. I've pinpointed the location where this happens. The child controller (which is a class that I reuse for every row of the same type) that's being switched into has an array of NSString's representing the rows that will be displayed. I set it before pushing the child viewcontroller. It's there where this apparently happens. I'm having a hard time debugging this problem, still wrestling with xcode and all. I fear there may be some vital information missing here, but maybe there is something you recognize here.

    Read the article

  • iPhone -trouble with a loading data from webservice into a tableview

    - by medampudi
    I am using a Window based application and then loading up my initial navigationview based controller. After loading it if the user is not registered/ does not have a credentials present then it takes the user to a login view controller . loginViewController *sampleView = [[loginViewController alloc] initWithNibName:@"loginViewController" bundle:nil]; [self.navigationController presentModalViewController:sampleView animated:YES]; [sampleView release]; then right after that i try to load the table with data that i get from a webservice using asiHTTP .. for this question lets say it takes 3 seconds time to get the data and then deserialize it . now... my question is it works out okey in the later runs as I store the username and password in a seure location... but in the first instance.... i am not able to get the data to laod to the tableview... I have tried a lot of things... 1. Initially the data fetch methods was in a diffrent methods.. so i thought that might be the problem as then moved it the same place as the tbleviewController(navigationController) 2. I event put in the Reload data at the end of the functionality for the data parsing and deserialization... nothing happens. 3. i did not understand the concept of @property and alll.... 4. The screen is black screen with nothing displayed on it for a good 5 seconds in the consecutive launches of the app.... so could we have something like a MBPorgressHUD implemented for the same. could any one please help for these scenarios and guidance as to what paths to take from here...

    Read the article

  • Frame sizing of tableview within nested child controllers/subviews

    - by jwoww
    I'm a bit confused by the proper frame sizing of a table view to fit within my screen. Here's my setup of view controllers within view controllers: UITabBarController UINavigationController as one of the tab bar viewcontrollers; title bar hidden ViewController - a container view controller because I need the option to place some controls beneath the UITableView, sometimes (but not in the current scenario) UITableViewController Now, my question is what the proper frame dimensions of the UITableview should be. Here's what I've got in the ViewController viewDidLoad method. I used subtracted 49.0 (the size of the tab bar) from 480.0. However, this leaves a black bar at the bottom. 20.0 appears to do it (coincidentally?) the size of the status bar, but I don't understand why that would be. Wouldn't the true pixel dimensions of the tableview be 480-49? // MessageTableViewController is my subclass of UITableViewController MessagesTableViewController *vcMessagesTable = [[MessagesTableViewController alloc] init]; CGRect tableViewFrame = CGRectMake(0, 0, 320.0, 480.0 - 49.0); [[vcMessagesTable view] setFrame:tableViewFrame]; self.tableViewController = vcMessagesTable; [self addChildViewController:vcMessagesTable]; [[self view] addSubview:vcMessagesTable.view]; Here's how it looks:

    Read the article

  • TableView frame not resizing properly when pushing a new view controller and the keyboard is hiding

    - by Pete
    Hi, I must be missing something fundamental here. I have a UITableView inside of a NavigationViewController. When a table row is selected in the UITableView (using tableView:didSelectRowAtIndexPath:) I call pushViewController to display a different view controller. The new view controller appears correctly, but when I pop that view controller and return the UITableView is resized as if the keyboard was being displayed. I need to find a way to have the keyboard hide before I push the view controller so that the frame is restored correctly. If I comment out the code to push the view controller then the keyboard hides correctly and the frame resizes correctly. The code I use to show the keyboard is as follows: - (void) keyboardDidShowNotification:(NSNotification *)inNotification { NSLog(@"Keyboard Show"); if (keyboardVisible) return; // We now resize the view accordingly to accomodate the keyboard being visible keyboardVisible = YES; CGRect bounds = [[[inNotification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue]; bounds = [self.view convertRect:bounds fromView:nil]; CGRect tableFrame = tableViewNewEntry.frame; tableFrame.size.height -= bounds.size.height; // subtract the keyboard height if (self.tabBarController != nil) { tableFrame.size.height += 48; // add the tab bar height } [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(shrinkDidEnd:finished:contextInfo:)]; tableViewNewEntry.frame = tableFrame; [UIView commitAnimations]; } The keyboard is hidden using: - (void) keyboardWillHideNotification:(NSNotification *)inNotification { if (!keyboardVisible) return; NSLog(@"Keyboard Hide"); keyboardVisible = FALSE; CGRect bounds = [[[inNotification userInfo] objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue]; bounds = [self.view convertRect:bounds fromView:nil]; CGRect tableFrame = tableViewNewEntry.frame; tableFrame.size.height += bounds.size.height; // add the keyboard height if (self.tabBarController != nil) { tableFrame.size.height -= 48; // subtract the tab bar height } tableViewNewEntry.frame = tableFrame; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(_shrinkDidEnd:finished:contextInfo:)]; tableViewNewEntry.frame = tableFrame; [UIView commitAnimations]; [tableViewNewEntry scrollToNearestSelectedRowAtScrollPosition:UITableViewScrollPositionMiddle animated:YES]; NSLog(@"Keyboard Hide Finished"); } I trigger the keyboard being hidden by resigning first responser for any control that is the first responder in ViewWillDisappear. I have added NSLog statements and see things happening in the log file as follows: Show Keyboard ViewWillDisappear: Hiding Keyboard Hide Keyboard Keyboard Hide Finished PushViewController (an NSLog entry at the point I push the new view controller) From this trace, I can see things happening in the right order, but It seems like when the view controller is pushed that the keyboard hide code does not execute properly. Any ideas would be really appreciated. I have been banging my head against the keyboard for a while trying to find out what I am doing wrong.

    Read the article

  • How can I make my tableview enter editing mode?

    - by Jake
    Hi, for some reason I can't get my tableview to enter editing mode. It's a little harder than it might seem because I'm using some open source code to make a calendar (iCal esque) with a tableview under it, and it's not quite as straightforward as just using a regular tableview. Basically, I have two classes. One (let's say Class A) is a UIViewController and the other (Class B) is that viewController's datasource and tableview delegate. In Class B, I've implemented -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath; which works fine, but if I put an edit nav bar item in Class A (the view controller), nothing happens. Am I forgetting certain protocols, or certain special methods that I need to write? Thanks for any help, and apologies if I'm missing something, I'm just learning to work with other people's code.

    Read the article

  • how to reloadData in tableView when tableview access data from database.

    - by Ajeet Kumar Yadav
    I am new in iphone i am developing a application that take value from data base and display data in tableview. in this application we save data from one data table to other data table this is when add first time work and when we do second time application is crash. how to solve this problem i am not understand code is given bellow my appdelegate code for insert value from one table to other is given bellow -(void)sopinglist { //////databaseName= @"SanjeevKapoor.sqlite"; databaseName =@"AjeetTest.sqlite"; NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDir = [documentPaths objectAtIndex:0]; databasePath =[documentsDir stringByAppendingPathComponent:databaseName]; [self checkAndCreateDatabase]; list1 = [[NSMutableArray alloc] init]; sqlite3 *database; if (sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) { if(addStmt == nil) { ///////////const char *sql = "insert into Dataa(item) Values(?)"; const char *sql = " insert into Slist select * from alootikki"; ///////////// const char *sql =" Update Slist ( Incredients, Recipename,foodtype) Values(?,?,?)"; if(sqlite3_prepare_v2(database, sql, -1, &addStmt, NULL) != SQLITE_OK) NSAssert1(0, @"Error while creating add statement. '%s'", sqlite3_errmsg(database)); } /////for( NSString * j in k) sqlite3_bind_text(addStmt, 1, [k UTF8String], -1, SQLITE_TRANSIENT); //sqlite3_bind_int(addStmt,1,i); // sqlite3_bind_text(addStmt, 1, [coffeeName UTF8String], -1, SQLITE_TRANSIENT); // sqlite3_bind_double(addStmt, 2, [price doubleValue]); if(SQLITE_DONE != sqlite3_step(addStmt)) NSAssert1(0, @"Error while inserting data. '%s'", sqlite3_errmsg(database)); else //SQLite provides a method to get the last primary key inserted by using sqlite3_last_insert_rowid coffeeID = sqlite3_last_insert_rowid(database); //Reset the add statement. sqlite3_reset(addStmt); // sqlite3_clear_bindings(detailStmt); //} } sqlite3_finalize(addStmt); addStmt = nil; sqlite3_close(database); } And the table View code for access data from database is given bellow SanjeevKapoorAppDelegate *appDelegate =(SanjeevKapoorAppDelegate *)[[UIApplication sharedApplication] delegate]; [appDelegate sopinglist]; ////[appDelegate recpies]; /// NSArray *a =[[appDelegate list1] componentsJoinedByString:@","]; k= [[appDelegate list1] componentsJoinedByString:@","];

    Read the article

  • how to clear a data in tableviewcell again start reload?

    - by Ios_learner
    i'm developing a bluetooth apps.1) I want to hide a tableview when i start the apps..after i pressed a action button i want to enable a tableview.. 2)if i again press a action button means tableviewcell clear the data and show empty before searching..give me an idea.. some of the code- - (IBAction)connectButtonTouched:(id)sender { [self.deviceTable reloadData]; self.connectButton.enabled = YES; [self.deviceTable reloadData]; peripheralManager = [[PeripheralManager alloc] init]; peripheralManager.delegate = self; [peripheralManager scanForPeripheralsAndConnect]; [self.deviceTable reloadData]; [NSTimer scheduledTimerWithTimeInterval:(float)5.0 target:self selector:@selector (connectionTimer:) userInfo:nil repeats:YES]; alert=[[UIAlertView alloc] initWithTitle:@"Bluetooth" message:@"Scanning" delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles:nil]; UIActivityIndicatorView *progress=[[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(125, 50, 30, 30)]; [alert addSubview:progress]; [progress startAnimating]; [alert show]; } tableview -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [device count]; } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier=@"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if(cell==nil) { cell =[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } cell.textLabel.text=[device objectAtIndex:indexPath.row]; cell.accessoryType=UITableViewCellAccessoryDetailDisclosureButton; return cell; } TableView Delegate - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell=[tableView cellForRowAtIndexPath:indexPath]; [self performSegueWithIdentifier:@"TableDetails" sender:tableView]; }

    Read the article

  • PyQt4 and QTableView with spinbox and checkbox

    - by ekapek
    Hi, I have a QTableView with QSqlTableModel and with 3 columns, now I need to have: - second column: spinbox after clicked to edit - third column: checkbox (displayed center) My code: class SpinBoxDelegate(QtGui.QItemDelegate): def createEditor(self, parent, option, index): editor = QtGui.QSpinBox(parent) editor.setMinimum(0) editor.setMaximum(100) print 'spinbox' return editor def setEditorData(self, spinBox, index): value = index.model().data(index, QtCore.Qt.EditRole).toInt()[0] spinBox.setValue(value) def setModelData(self, spinBox, model, index): spinBox.interpretText() value = spinBox.value() model.setData(index, value, QtCore.Qt.EditRole) def updateEditorGeometry(self, editor, option, index): editor.setGeometry(option.rect) class myQSqlTableModel(QtSql.QSqlTableModel): def flags(self,index): result = QtSql.QSqlTableModel.flags(self,index); if index.column() == 2: result |= QtCore.Qt.ItemIsUserCheckable return result def data(self,index,role): if not index.isValid: return QtCore.QVariant() value = QtSql.QSqlTableModel.data(self, index, role) if index.column() == 2: if role == QtCore.Qt.CheckStateRole: return QtCore.Qt.Unchecked if QtSql.QSqlTableModel.data(self, index).toInt()[0] else QtCore.Qt.Checked elif role == QtCore.Qt.DisplayRole: return QtCore.QVariant() return value and self.model = myQSqlTableModel(self) self.model.setTable("person") self.model.setEditStrategy(QtSql.QSqlTableModel.OnManualSubmit) self.model.select(): self.model.setHeaderData(0, QtCore.Qt.Horizontal, self.tr("ID")) self.model.setHeaderData(1, QtCore.Qt.Horizontal, self.tr("A")) self.model.setHeaderData(2, QtCore.Qt.Horizontal, self.tr("B")) self.view = QtGui.QTableView() self.view.setModel(self.model) self.view.setSortingEnabled(True) spinDelegate = SpinBoxDelegate() self.view.setItemDelegateForColumn(1,spinDelegate) but it does't work: spinbox don't show after click and checkbox can't be clicked and is aligned to left Any help?

    Read the article

  • Draw a Custom cell for tableview ( uitableview ) , with changed colors and separator color and width

    - by Madhup
    Hi, I want to draw the background of a UITableViewCell which has a grouped style. The problem with me is I am not able to call the -(void)drawRect:(CGRect)rect or I think it should be called programmatically... I have taken code from following link . http://stackoverflow.com/questions/400965/how-to-customize-the-background-border-colors-of-a-grouped-table-view/1031593#1031593 // // CustomCellBackgroundView.h // // Created by Mike Akers on 11/21/08. // Copyright 2008 __MyCompanyName__. All rights reserved. // #import <UIKit/UIKit.h> typedef enum { CustomCellBackgroundViewPositionTop, CustomCellBackgroundViewPositionMiddle, CustomCellBackgroundViewPositionBottom, CustomCellBackgroundViewPositionSingle } CustomCellBackgroundViewPosition; @interface CustomCellBackgroundView : UIView { UIColor *borderColor; UIColor *fillColor; CustomCellBackgroundViewPosition position; } @property(nonatomic, retain) UIColor *borderColor, *fillColor; @property(nonatomic) CustomCellBackgroundViewPosition position; @end // // CustomCellBackgroundView.m // // Created by Mike Akers on 11/21/08. // Copyright 2008 __MyCompanyName__. All rights reserved. // #import "CustomCellBackgroundView.h" static void addRoundedRectToPath(CGContextRef context, CGRect rect, float ovalWidth,float ovalHeight); @implementation CustomCellBackgroundView @synthesize borderColor, fillColor, position; - (BOOL) isOpaque { return NO; } - (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { // Initialization code } return self; } - (void)drawRect:(CGRect)rect { // Drawing code CGContextRef c = UIGraphicsGetCurrentContext(); CGContextSetFillColorWithColor(c, [fillColor CGColor]); CGContextSetStrokeColorWithColor(c, [borderColor CGColor]); CGContextSetLineWidth(c, 2.0); if (position == CustomCellBackgroundViewPositionTop) { CGFloat minx = CGRectGetMinX(rect) , midx = CGRectGetMidX(rect), maxx = CGRectGetMaxX(rect) ; CGFloat miny = CGRectGetMinY(rect) , maxy = CGRectGetMaxY(rect) ; minx = minx + 1; miny = miny + 1; maxx = maxx - 1; maxy = maxy ; CGContextMoveToPoint(c, minx, maxy); CGContextAddArcToPoint(c, minx, miny, midx, miny, ROUND_SIZE); CGContextAddArcToPoint(c, maxx, miny, maxx, maxy, ROUND_SIZE); CGContextAddLineToPoint(c, maxx, maxy); // Close the path CGContextClosePath(c); // Fill & stroke the path CGContextDrawPath(c, kCGPathFillStroke); return; } else if (position == CustomCellBackgroundViewPositionBottom) { CGFloat minx = CGRectGetMinX(rect) , midx = CGRectGetMidX(rect), maxx = CGRectGetMaxX(rect) ; CGFloat miny = CGRectGetMinY(rect) , maxy = CGRectGetMaxY(rect) ; minx = minx + 1; miny = miny ; maxx = maxx - 1; maxy = maxy - 1; CGContextMoveToPoint(c, minx, miny); CGContextAddArcToPoint(c, minx, maxy, midx, maxy, ROUND_SIZE); CGContextAddArcToPoint(c, maxx, maxy, maxx, miny, ROUND_SIZE); CGContextAddLineToPoint(c, maxx, miny); // Close the path CGContextClosePath(c); // Fill & stroke the path CGContextDrawPath(c, kCGPathFillStroke); return; } else if (position == CustomCellBackgroundViewPositionMiddle) { CGFloat minx = CGRectGetMinX(rect) , maxx = CGRectGetMaxX(rect) ; CGFloat miny = CGRectGetMinY(rect) , maxy = CGRectGetMaxY(rect) ; minx = minx + 1; miny = miny ; maxx = maxx - 1; maxy = maxy ; CGContextMoveToPoint(c, minx, miny); CGContextAddLineToPoint(c, maxx, miny); CGContextAddLineToPoint(c, maxx, maxy); CGContextAddLineToPoint(c, minx, maxy); CGContextClosePath(c); // Fill & stroke the path CGContextDrawPath(c, kCGPathFillStroke); return; } else if (position == CustomCellBackgroundViewPositionSingle) { CGFloat minx = CGRectGetMinX(rect) , midx = CGRectGetMidX(rect), maxx = CGRectGetMaxX(rect) ; CGFloat miny = CGRectGetMinY(rect) , midy = CGRectGetMidY(rect) , maxy = CGRectGetMaxY(rect) ; minx = minx + 1; miny = miny + 1; maxx = maxx - 1; maxy = maxy - 1; CGContextMoveToPoint(c, minx, midy); CGContextAddArcToPoint(c, minx, miny, midx, miny, ROUND_SIZE); CGContextAddArcToPoint(c, maxx, miny, maxx, midy, ROUND_SIZE); CGContextAddArcToPoint(c, maxx, maxy, midx, maxy, ROUND_SIZE); CGContextAddArcToPoint(c, minx, maxy, minx, midy, ROUND_SIZE); // Close the path CGContextClosePath(c); // Fill & stroke the path CGContextDrawPath(c, kCGPathFillStroke); return; } } - (void)dealloc { [borderColor release]; [fillColor release]; [super dealloc]; } @end static void addRoundedRectToPath(CGContextRef context, CGRect rect, float ovalWidth,float ovalHeight) { float fw, fh; if (ovalWidth == 0 || ovalHeight == 0) {// 1 CGContextAddRect(context, rect); return; } CGContextSaveGState(context);// 2 CGContextTranslateCTM (context, CGRectGetMinX(rect),// 3 CGRectGetMinY(rect)); CGContextScaleCTM (context, ovalWidth, ovalHeight);// 4 fw = CGRectGetWidth (rect) / ovalWidth;// 5 fh = CGRectGetHeight (rect) / ovalHeight;// 6 CGContextMoveToPoint(context, fw, fh/2); // 7 CGContextAddArcToPoint(context, fw, fh, fw/2, fh, 1);// 8 CGContextAddArcToPoint(context, 0, fh, 0, fh/2, 1);// 9 CGContextAddArcToPoint(context, 0, 0, fw/2, 0, 1);// 10 CGContextAddArcToPoint(context, fw, 0, fw, fh/2, 1); // 11 CGContextClosePath(context);// 12 CGContextRestoreGState(context);// 13 } but the problem is my drawRect is not getting called automatically......... I am doing it like this. CustomCellBackgroundView *custView = [[CustomCellBackgroundView alloc] initWithFrame:CGRectMake(0,0,320,44)]; [cell setBackgroundView:custView]; [custView release]; and doing this gives me transparent cell. I tried and fought with code but could get any results. Please help me out. I am really having no idea how this code will run.

    Read the article

  • cellForRowAtIndexPath not being called on tableView reloadData

    - by BotskoNet
    I have a UITableView on one view that loads in data at the start of the application, and then later when a user enters text into a box and hits a button, I re-query the database, re-populate the original NSMutableArray that stores the data for the table. All of that is working perfectly. In some logging statements I can tell that the array has the correct information, the numberOfRowsInSection method is returning the proper count, and is being called after the reload is called. However, the cellForRowAtIndexPath is never called the second time (after the reload) and the table data is never updated. I've spent hours searching the net and I've found nothing that helps. Can anyone help? All code is at: http://github.com/botskonet/inmyspot The specific reload is being called at: http://github.com/botskonet/inmyspot/blob/master/Classes/InMySpotViewController.m Roughly Line 94 From: http://github.com/botskonet/inmyspot/blob/master/Classes/PlateFormViewController.m Roughly line 101 A bit more info: once the new data has been added to the mutablearray, if I try to start scrolling the table, it eventually dies with: "Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSCFArray objectAtIndex:]: index (29) beyond bounds (29)'" Which I assume means the table cells can't find any data in the array to match the scroll position, which seems to be because the array has the new data, but the table doesn't.

    Read the article

  • UIImages not displaying in TableView on iPhone, but working in Simulator

    - by Graeme
    Hi, I have a UITable View that displays an image in the left hand side of the table cell, and it works fine in the simulator. Only problem is, once I ran it on my device no images appear. It's just a blank white space. Have checked that images are added to resource folder for build (which they are) and that capitals etc. match (which they do). Any ideas? Thanks. Code to display images: cell.imageView.layer.masksToBounds = YES; cell.imageView.layer.cornerRadius = 5.0; UIImage *image = [UIImage imageNamed:[[dog types] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]];; if ( image ) { cell.imageView.image = [image imageScaledToSize:CGSizeMake(50, 50)]; }

    Read the article

  • TableView as DetailView's subview with a UISplitViewController?

    - by Gerry
    I have a UISplitViewController, I used the iPad template to start. To change the type of view in the detailview area, I'm adding my view types as subviews to the DetailViewController's view. This works for UIViewController derived views, but not for UITableViewController view types?. Why would this be? My problem is rooted in the fact that the manufactured DetailView is the UISplitViewController's delegate. To get the correct popover behaviour, I'd like to keep it add buttons to its toolbar and then based on user selection open different details when master list selections are made. Thanks,

    Read the article

  • switch views using a button, going to a table view, iphone

    - by Jaime Rae
    My program has 4 buttons and each button calls a different table view. That works fine, but my problem is, the view controller I'm using brings up a table view that covers up my navigation bar and my tab bar. I need to replace that coding with something that will bring up a table and not cover up my nav and tab bars. Here is the coding I'm using: -(IBAction)buttonNorthWest { NorthWestViewController *nwController = [[NorthWestViewController alloc] initWithNibName:@"NorthWestView" bundle:nil]; self.nwViewController = nwController; [self.view insertSubview:nwViewController.view atIndex:0]; [self presentModalViewController:nwViewController animated:YES]; [nwController release]; } The [self presentModalViewController....] is the problem. Does anyone know how I can replace that code with something that keeps my nav and tab bars? Thanks, Jaime

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >