mmk Posted March 30, 2008 Share Posted March 30, 2008 so how did you get the label to clear and overwrite the text (to avoid 1 + 3 = ' )? I'm getting the same problem in another project. thanks In IB label properties you have clear context before drawing. Link to comment Share on other sites More sharing options...
alpineedge3 Posted March 31, 2008 Share Posted March 31, 2008 In IB label properties you have clear context before drawing. doh! thanks Link to comment Share on other sites More sharing options...
DaveGee Posted March 31, 2008 Share Posted March 31, 2008 Attached is a screenshot of the controls I was asking about... If anyone knows how or what I need to do to get the trigger of those blue buttons I'd be very happy... Dave Link to comment Share on other sites More sharing options...
mp05 Posted March 31, 2008 Share Posted March 31, 2008 Hey , are NSLog statements getting printed in the xcode console?. when i was using the first SDK beta version,it worked fine. Now i am not seeing any of my NSLog statements in the console(i have the second SDK beta version installed). This happens only for the iPhone application,when i use the same xcode to build a Mac OS application, NSLog statements are getting displayed in the console. You can trust me that there is no issue with th NSLog statement ( NSLog(@"test "); ) . any idea? ~mp Link to comment Share on other sites More sharing options...
JoLePaBo Posted March 31, 2008 Share Posted March 31, 2008 Hello, This is my first post (I am sorry, but I am working on a project for estimating the investment in iPhone development). This is mostly to check some aspect that from our point of view can be dealbreakers. One of our concern is the MVC models. Both example posted (thanks a lot for the contributors) aren't compliant, but sure a good workaround. Is there anyone having an example working with a clean MVC solution ? I am personally enable to even reproduce the simple check-in application (Cocoa core data tutorial), which is a very easy application to design. I guess it is still to early to focus on such aspects, which are more likely to be solved in the next beta. Link to comment Share on other sites More sharing options...
stroke Posted March 31, 2008 Author Share Posted March 31, 2008 mp05, I have the same problem. JoLePaBo, if you are asking about Core Data, there is no support for it, and probably won't be. Link to comment Share on other sites More sharing options...
Mark Snow Posted March 31, 2008 Share Posted March 31, 2008 Hi all, I discovered it is actually possible to load a Nib automatically. The IB 3 beta2 release notes explains you must add manually a key to the Info.plist dictionary, like this: <key>NSMainNibFile</key> <string>MainWindow</string> That's all. I got a nib loaded and the awakeFromNib handler of an IB instanciated object is called. But ... the simulator crashes with a message "this class is not key-value compliant with the <outlet name> key". I tried to use IBOutlet with properties but it still crashes. Please, try it and tell me. The good news is that it is possible to avoid all the tricky code i've seen above. Link to comment Share on other sites More sharing options...
Ian Davies Posted March 31, 2008 Share Posted March 31, 2008 Attached is a screenshot of the controls I was asking about... If anyone knows how or what I need to do to get the trigger of those blue buttons I'd be very happy... Dave Hi Dave, I believe you're after the – tableView:accessoryButtonClickedForRowWithIndexPath: method of the UITableViewDelegate protocol.. I had played with this in beta 1 but haven't got far in beta 2 yet. Still getting my head around IB. Cheers, Ian Link to comment Share on other sites More sharing options...
DaveGee Posted March 31, 2008 Share Posted March 31, 2008 Hi Dave, I believe you're after the – tableView:accessoryButtonClickedForRowWithIndexPath: method of the UITableViewDelegate protocol.. I had played with this in beta 1 but haven't got far in beta 2 yet. Still getting my head around IB. Cheers, Ian Thats what I thought... I found that (somewhere) ... maybe the iPhone sdk reference (don't remember now) Anyway I have this in my controller - (void)tableView:(UITableView *)tableView accessoryButtonClickedForRowWithIndexPath:(NSIndexPath *)indexPath { NSLog(@"==========================="); NSLog(@"HERE I AM!!!"); NSLog(@"==========================="); NSLog(@"HERE I AM!!!"); NSLog(@"==========================="); } But when I click on that bugger nuttin happens... is their somewhere else I have to do some other coding to get it to work?? The only other thing I've done different apart from the normal tableview example code I had before is change the UITableViewCellAccessoryDisclosureIndicator to UITableViewCellAccessoryDetailDisclosureButton. Everything else still works, even now when I click on the line (anywhere BUT that icon) the other/next tableview still comes up as it always did. What I want in the end is: 1 - User clicks on anywhere BUT the icon and I call a little routine (already written) that turns off the device that was clicked but then I stay on the menuview (I'll also update the icon to show the new lighting condition and do a menu refresh). The way things are now clicking here take you to another menuview... I will swap this code to the action below. 2 - User clicks ON the blue-button and the user is taken that other menuview (I spoke about above) where he/she has more controls/info displayed to them. I have this menuview already but at the moment it only comes up when anywhere BUT the button is pressed. I will take the code mentioned above and put it here in this action. Thanks for helping!! Dave Link to comment Share on other sites More sharing options...
stroke Posted March 31, 2008 Author Share Posted March 31, 2008 Make sure to set the tableview's delegate to self, and also, NSLog appears to be busted in Beta 2, so that may also be why "nothing is happening." Link to comment Share on other sites More sharing options...
alpineedge3 Posted March 31, 2008 Share Posted March 31, 2008 NSLog appears to be busted in Beta 2, so that may also be why "nothing is happening." NSLog outputs to System Console now. Link to comment Share on other sites More sharing options...
DaveGee Posted March 31, 2008 Share Posted March 31, 2008 Make sure to set the tableview's delegate to self, and also, NSLog appears to be busted in Beta 2, so that may also be why "nothing is happening." Ill check out the delegate thing but since clicking on anywhere but the blue-icon works as it should I think it might indeed be set correctly. As for nslog not working... well I seem get it to fire much of the time but I have noticed an occasion or three where it fired 'way late' or not at all... I found making 'more' nslogs (and or longer ones) kick things into gear (but I may just be fooling myself - lol) I'll check the delegate thing and then come back and edit this post with whatever my results were... EDIT: (yea that was fast...) This is how it was already.... (delegate was indeed set to self - see code below) theTableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain]; theTableView.delegate = self; theTableView.dataSource = self; theTableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine; Oh and I even put some ACTUAL code in accessoryButtonClickedForRowWithIndexPath just to make doubly sure and nope -- the button press isn't being sent to it. Dave Link to comment Share on other sites More sharing options...
stroke Posted April 1, 2008 Author Share Posted April 1, 2008 Yeah, you're right, it still outputs to the system console (Console.app will allow you to see this). So it actually appears as though the debug console itself has some issues… DaveGee: Check Console.app and see if anything is being logged, or try something visible in the app itself (like [uIApp terminate:nil]). Link to comment Share on other sites More sharing options...
DaveGee Posted April 1, 2008 Share Posted April 1, 2008 Yeah, you're right, it still outputs to the system console (Console.app will allow you to see this). So it actually appears as though the debug console itself has some issues… DaveGee: Check Console.app and see if anything is being logged, or try something visible in the app itself (like [uIApp terminate:nil]). Yep see my edit post above... tried that stuff and still no-go... I have a feeling either this isn't (for some reason) implemented fully yet (since not a singe example is using it) or its something else that I have to do before it'll start calling accessoryButtonClickedForRowWithIndexPath. Weird tho.. since it seems like it should 'just work'... oh and yea I was always using console.app to see my log messages (which is why I was seeing them at all - lol) Dave Link to comment Share on other sites More sharing options...
mp05 Posted April 1, 2008 Share Posted April 1, 2008 i have a text-field (its an IBOutlet of UITextField) on the screen i which accepts some number,i need to take this value into a float variable in my code. any idea which is the class and method used for this purpose. if some one has found already, pls share it.. Link to comment Share on other sites More sharing options...
DaveGee Posted April 1, 2008 Share Posted April 1, 2008 i have a text-field (its an IBOutlet of UITextField) on the screen i which accepts some number,i need to take this value into a float variable in my code. any idea which is the class and method used for this purpose. if some one has found already, pls share it.. isn't it something like: float myfloat; myfloat = [textField floatValue]; I know thats the way it works for NStrings. Dave Link to comment Share on other sites More sharing options...
stroke Posted April 1, 2008 Author Share Posted April 1, 2008 mp05, do something like: NSString *string = [NSString stringWithFormat:@"%f", 1.618]; NSScanner *strScan = [NSScanner scannerWithString:string]; float value; [strScan scanFloat:&value]; That will put any floats found in the string into the variable 'value' (NSLogging 'value' will print 1.618). DaveGee, that won't work; UITextField doesn't have anything to retrieve int, floats, etc, just text as an NSString (field.text). Link to comment Share on other sites More sharing options...
mp05 Posted April 1, 2008 Share Posted April 1, 2008 No DaveGee. I have tried it already, its not working. Link to comment Share on other sites More sharing options...
mmk Posted April 1, 2008 Share Posted April 1, 2008 Anyone made a UITableView in IB working? In my examples the view will not get "updated" after some other view was on the screen. Link to comment Share on other sites More sharing options...
stroke Posted April 1, 2008 Author Share Posted April 1, 2008 Try doing [tableView reloadData]; Link to comment Share on other sites More sharing options...
PascalW Posted April 1, 2008 Share Posted April 1, 2008 mp05, do something like: NSString *string = [NSString stringWithFormat:@"%f", 1.618]; NSScanner *strScan = [NSScanner scannerWithString:string]; float value; [strScan scanFloat:&value]; That will put any floats found in the string into the variable 'value' (NSLogging 'value' will print 1.618). DaveGee, that won't work; UITextField doesn't have anything to retrieve int, floats, etc, just text as an NSString (field.text). That's pretty ineffecient. Just do something like this: float f = [self.textField.text floatValue]; Link to comment Share on other sites More sharing options...
mp05 Posted April 1, 2008 Share Posted April 1, 2008 Thanks a lot pascal... finally it worked with the following code. float rate = [rateField.text floatValue]; rateField is a textfield on the screen which is an IBOutlet. Link to comment Share on other sites More sharing options...
DaveGee Posted April 1, 2008 Share Posted April 1, 2008 Just do something like this: float f = [self.textField.text floatValue]; Hah! I knew it was something like that... Link to comment Share on other sites More sharing options...
DaveGee Posted April 1, 2008 Share Posted April 1, 2008 Okay... Still researching that issue I'm having... I found this: accessoryAction The selector defining the action message to invoke when users tap the accessory view. @property SEL accessoryAction Discussion The accessory view is a UITableViewCell-defined control, framework control, or custom control on the right side of the cell. It is often used to display a new view related to the selected cell. See accessoryView for more information. If the value of this property is NULL, no action message is sent. Availability Available in iPhone OS 2.0 and later. See Also @property target @property editAction Declared In UITableViewCell.h but have no idea how to implement this... I see this as another example I could learn from: editAction The selector defining the action message to invoke when users tap the insert or delete button. @property SEL editAction Discussion When the cell’s table is in editing mode, the cell displays a green insert control or a red delete control to the left of it. (The selectedBackgroundView constant applied to the cell via the editingStyle property determines which control is used.) Typically, the associated UITableView object sets the editing action for all cells; you can use this property to alter the editing action for individual cells. If the value of this property is nil, no action message is sent. Availability Available in iPhone OS 2.0 and later. See Also @property target @property accessoryAction Declared In UITableViewCell.h But I can't seem to find any source code using that either... the good news is I think I'm on the right track... Dave Link to comment Share on other sites More sharing options...
stroke Posted April 1, 2008 Author Share Posted April 1, 2008 PascalW, that works, but only if the only thing in the string is a float, which isn't always the case. NSScanners will scan the whole string picking up any floats. DaveGee, you would do something like cell.accessoryView = (accessory view to use) and cell.accessoryAction = @selector(action:). You should implement these in your table's data source, so you can set them based on the cell index. Link to comment Share on other sites More sharing options...
Recommended Posts