Skip to main content

Posts

Showing posts from February 25, 2012

Java - Order of Operations - Using Two Assignment Operators in a Single Line

What are the order of operations when using two assignment operators in a single line? public static void main(String[] args){ int i = 0; int[] a = {3, 6}; a[i] = i = 9; // this line in particular System.out.println(i + " " + a[0] + " " + a[1]); } Edit: Thanks for the posts. I get that = takes values from the right, but when I compile this I get: 9 9 6 I thought it would have been and ArrayOutOfBounds exception, but it is assigning 'a[i]' before it's moving over the 9. Does it just do that for arrays?

Filereader null declarations and appending best practice

I want to optimise my file reader function but am not sure if it is best practice to declare the nulls outside of the try loop. Also, is looping and appending chars to a Stringbuffer considered bad practice? I would like to use the exception handling here, but maybe it is better to use another structure? any advice most welcome, thanks. public String readFile(){ File f = null; FileReader fr = null; StringBuffer content = null; try{ f = new File("c:/test.txt"); fr = new FileReader(f); int c; while((c = fr.read()) != -1){ if(content == null){ content = new StringBuffer(); } content.append((char)c); } fr.close(); } catch (Exception e) { throw new RuntimeException("An error occured reading your file"); } return content.toString(); } }

I wrote a "Rock, Paper, Scissor, Shoot” game in one method using Java. I need help looping the program

I am able to loop the program, but each time I input a value it will return 2 values, the user winning and the user losing. I've experimented using multiple methods and creating a new class which was the tester, but had some problems figuring out the logic. As for loops, I have tried using a for loop, while, and do while. Thanks in advance! // Rock Paper Scissor Shoot Game import java.util.Random; import java.util.Scanner; public class RockPaperSciccor { public static void main(String[] args){ int wins = 0; int losses = 0; int rnd; for(rnd=0;rnd<=10;rnd++) { Random GAME = new Random(); int PC = 1+GAME.nextInt(3); Scanner input = new Scanner (System.in); int SCISSOR, ROCK, PAPER; SCISSOR = 1; ROCK = 2; PAPER = 3; System.out.println(""); System.out.println("Choose Your Weapon! "); System.out.println("1 = Scissor| 2 = Rock| 3 = Paper"); System.out.println(""); int USER

Extending Protocol Buffers in Java

I'm having trouble accessing extended protocol buffer members. Here is the scenario: Message Foo { optional int i = 1; } message Bar { extend Foo { optional int j = 10001; } } I don't have the Bar message within any of my other protos. How can I get Bar.j in Java? All examples I've found require a Bar within a message. Thanks!

Respond encoding of Google App Engine(can not change response encoding)

public class FeedUpdaterServlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { PrintWriter out = resp.getWriter(); req.setCharacterEncoding("utf-8"); resp.setLocale(Locale.TAIWAN); resp.setContentType("text/html; charset=utf-8"); resp.setCharacterEncoding("utf-8"); resp.getWriter().println("Hello, world!!@!"); out.println("我是人"); //some chinese character out.println(resp.getCharacterEncoding()); out.flush(); out.close(); } } web xml <locale-encoding-mapping-list> <locale-encoding-mapping> <locale>zh_TW</locale> <encoding>utf-8</encoding> </locale-encoding-mapping> </locale-encoding-mapping-list> Output: Hello, world!!@! ??? ISO-8859-1 It seems that the encoding of the respond can not be changed, what is happening???

Java - Get first and last name of user

Here is my situation. I am writing a program that will store a database. Currently, the way of identifying the user is by their computer user name. I am very desperate here, so any ideas will work. I am looking for ANY method (doesn't always need to work) for BOTH OSX and Windows computers that will somehow fetch the user's first and last name. Thank you all in advance!

Getting the windows Command prompt back

Is there a way we can get Command prompt of windows 7 back? In linux we append "&" ? I actually run a java program which will listen on a port continously. It is working in lunux as it gives the terminal back but "&" is not working in the windows cmd. Thanks

Image is not displayed on reterival

I have a table with Images stored in it as BLOB. I'm using JPA/Hibernate. So, that Images are mapped to a bean field with type blob. Now my Spring controller is returning entire list of bean (each object of this bean has a blob object) to my jsp. I want to display all the images on that jsp. So, I tried to use some thing like this on my jsp, <c:forEach items="${itemList}" var="item" varStatus="status" > <img src="<c:out value="${item.image}" />"/><br/> /*<img src="${item.image}"/> */ </c:forEach> but that is not working. Instead of getting the list of images displayed on jsp , I 'm getting the class name, when I view the page source I saw something like this <img src="java.object.serilizableBlob@2134"/> Please help me delve with the problem. How can I display all the images on same jsp.

Why is getSize() not working for me here and why the flicker when resizing?

This is my first attempt at using BufferStrategy and I'd really appreciate some hints. 1) Why, in the below code, does getSize() return dimensions of 0 until you have resized the window? How can I detect the size of the window right away? 2) Why when getSize() is returning something is it not the full dimensions of the window? IE why is there a blackless strip to the bottom and right? 3) Is there a way to get rid of the flicker when you resize the window? import java.awt.Color; import java.awt.Graphics2D; import java.awt.image.BufferStrategy; import javax.swing.JFrame; import javax.swing.JPanel; public class BSTest extends JFrame { BufferStrategy bs; DrawPanel panel = new DrawPanel(); public BSTest() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(800,420); setLocationRelativeTo(null); setIgnoreRepaint(true); setVisible(true); createBufferStrategy(2); bs = getBufferStrategy(); panel.set

Working with Neo4J REST API

I have several questions? How can i query the node by its property? I see only to query by node id. And how can I get, for example all friends and unconfirmed friends of the node? At the moment I can do that only by querying the all relationships of the node, and iterate over it by checking the property of each relationship. My idea as the following: a node has parameter - id (userID), relationship has properties - directions - FROM_ME or TO_ME, status - CONFIRMED, UNCONFIRMED. All the quries are performed in REST API in Java. How can I do that in the simple way like in SQL, f.e., SELECT friends WHERE friend_id = 1? References to some tutorials with the solutions and techniques of such questions qould be appreciated

inputStream data lost

I am doing simple client-server in Java. This is my client code. try { socket = new Socket(serverIP, serverport); dataStream = new DataOutputStream(new BufferedOutputStream( socket.getOutputStream())); long[] data = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; for (int i = 0; i < data.length; i++) { dataStream.writeLong(data[i]); System.out.println("So far" + dataStream.size()); } } } catch (IOException e) { e.printStackTrace(); } finally { if (socket != null) try { socket.close(); dataStream.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } This works fine because I can see that a mount of bytes have been written to the server. Here goes the server code. try { ServerSocket newSocket = new ServerSocket(2503);

Simple Java OpenGL Textures Manager

I'm trying to make a simple textures manager for a 2D tile-based project. What I have is a class that has a hashmap of strings (texture name) and textures. If the name doesn't exist in the hashmap, it uses TextureIO.newTexture(..) to create it and store it into the hashmap. This is the error I get when I try to load a texture: Exception in thread "Timer-0" javax.media.opengl.GLException: java.lang.IllegalArgumentException: Illegally formatted version identifier: "null" at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:271) at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:410) at javax.media.opengl.GLCanvas.display(GLCanvas.java:244) at com.sun.opengl.util.Animator.display(Animator.java:144) at com.sun.opengl.util.FPSAnimator$1.run(FPSAnimator.java:95) at java.util.TimerThread.mainLoop(Unknown Source) at java.util.TimerThread.run(Unknown Source) Caused by: java.lang.IllegalArgumen

iPhone app design storyboard vs nib

As a beginning developer I'm wondering what the pros and cons are of using Storyboard vs. .nib files to build app interfaces. I'm aware that: Storyboards supposedly streamline the process of creating interfaces Apps created with storyboards are not compatible with devices running pre-iOS 5 However, I'd like to ask people with experience what the unforeseen drawbacks or advantages may be to using one method over the other, and what experienced developers recommend starting out on. (I'll be developing both for personal and commercial use.) Thank you very much!

How to auto insert Current DATE in SQL with Java / Hibernate

I need to add automatically the current date into my Database when I create a new OperantionBank. I'm using Hibernate. Thanks import java.io.Serializable; import java.sql.Date; import javax.persistence.*; import org.hibernate.annotations.Generated; import org.hibernate.annotations.GenerationTime; @Entity public class OperationBank implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String wordring; private Double amount; @Generated(GenerationTime.ALWAYS) @Temporal(javax.persistence.TemporalType.DATE) private Date dateoperation = new java.sql.Date(new java.util.Date().getTime()); @OneToOne private Account account;

GUI to run and deploy web application

I built java GUI interface for an Editor application , the editor is used to write java web application code , I want to add button to the editor , so when user click on the button the web application start working , and if there is an exception in the web application , all the exception is written in file ( ie. log.txt file ) Can someone help me in that Thank you very much for you

How to control alignment of mail header?

I encounter a situation, when I send a email which email subject more than 80 char, sometimes the email subject will be insert a 'tab' char. I check the invalid email's mail header, they are aligned, if a mail header entry more than 80 char, it will be wrap to a new line, and insert a 'tab'. I don't know which configuration control it, javaMail setting? STMP setting?

How to make a JPanel inside a JFrame fill the whole window?

In the below example, how can I get the JPanel to take up all of the JFrame? I set the preferred size to 800x420 but it only actually fills 792x391. import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.image.BufferStrategy; import javax.swing.JFrame; import javax.swing.JPanel; public class BSTest extends JFrame { BufferStrategy bs; DrawPanel panel = new DrawPanel(); public BSTest() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new BorderLayout()); // edited line setVisible(true); setSize(800,420); setLocationRelativeTo(null); setIgnoreRepaint(true); createBufferStrategy(2); bs = getBufferStrategy(); panel.setIgnoreRepaint(true); panel.setPreferredSize(new Dimension(800,420)); add(panel, BorderLayout.CENTER); // edited line panel.drawStuff(); } public class DrawPanel extends JPanel { public void drawStu

Twitter like App rejected [closed]

I have an App which is rejected which behaves as the Twitter App on the ground that: 10.4 Apps that create alternate desktop/home screen environments or simulate multi-app widget experiences will be rejected with as description: We found your app includes a dashboard view which presents multiple windows at once, and is therefore not in compliance with the App Store Review Guidelines. The iOS Human Interface Guidelines allow for multiple screens in an app but access to these screens should always be sequential, never simultaneous. Please see the attached screenshot/s for more information. It would be appropriate to modify your app by determining an alternate way users can accomplish the same task in a single screen or a sequence of screens. The screenshot attached is seen below. Can anybody explain what exactly the reason is, looking at the Twitter App. Anybody with a similar experience and a possible solution apart from completely dashing t

Guard Malloc doesn"t work

I'm experimenting with different profiling options that Xcode provides, but when I enabling Guard Malloc option in Diagnostics tab and trying to run, I'm getting this error with immediate crash: dyld: could not load inserted library: /usr/lib/libgmalloc.dylib And it is right, /usr/lib/ doesn't contain this library. I've located it in: Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib/ So I've created link, and started Command Line Tool (just to be sure, because it apparently part of MacOS SDK), enabled Guard Malloc again but the problem remains. I don't quite get where is a problem: does it new Xcode 4.3 inadvertence, problem with my system or planned decision by Apple to replace it with something else (maybe Instruments )?

Program a "No Photos In Albums&rdquo; screen

Is there a way to access this screen and edit it for your own program? Id want to change the "No Photos" text label. I already know how to edit the "albums" label, because I already built my UINavigation Controller. I guess mainly I want to know if this screen is usable or accessible to developers. EDIT: I don't want to access albums or the photo application from my program. I just want that image of the stacking photos in my application.

Is it possible to switch focus from one GLKview to another without reloading everything?

I am making an opengl 2.0 based game for iPad where I have added support for external displays. I want the game to be able to hot-swap between the local display and the external display. The issue I am experiencing is that as soon as I get a DrawInRect call to a newly created GLKview, belonging to a newly attached display, it seems all the shader programs and textures I set up in the old GLKview are no longer valid for the new GLKview. Will I need to recompile the shaders and reload all textures for new GLKview's? Or is there a better way to do it? I would really like to avoid having the game pause for 5-10 seconds while loading textures to the new display, especially since they are in fact already loaded and should be available somehow? Is there a way to transfer/share these data?

Adding UIView subclass programmatically not drawing itself

I don't understand how this works. If I draw a UIView object to my UIViewController .xib file, then my UIView redraws itself. If I add it to the subView like CustomView : UIView in UIViewController's viewDidLoad CustomView *v = [[CustomView alloc] initWithFrame:self.view.frame]; [self.view addSubview:v]; The CustomView not draw itself. I then tried to do [self.view setNeedsDisplay]; and I still get nothing. Just a white background (different than the black background I was getting before), but none of my drawing. How does it work when you add a UIView programmatically? thanks.

MapView and dealloc IOS

Hello i have a mapView and i think it takes too much memory after leaving the mapView here are my methods is anything missing? - (void)viewDidUnload { mapView.showsUserLocation = NO; b [mapView removeAnnotations:mapView.annotations]; [super viewDidUnload]; } -(void)dealloc{ [name release]; [type release]; [address release]; mapView.delegate = nil; [super dealloc]; } - (void)viewDidLoad{ foundLocation = location found <---- MKCoordinateRegion region; region.center.latitude = foundLocation.coordinate.latitude; region.center.longitude=foundLocation.coordinate.longitude; region.span.longitudeDelta=0.01; region.span.latitudeDelta=0.01; [mapView setRegion:region animated:NO]; ann = [[MapAnnotation alloc]init]; ann.title = name; ann.subtitle = type; ann.coordinate=region.center; [mapView addAnnotation:ann]; [ann release]; self.navigationItem.title=@"Map"; [super viewDidLoad]; } The

How to tell which rows toggle switch was changed

I have a tableview with the accessoryview of a toggle switch. I specify the section and the row and am having a difficult time determining which row was toggled. I used the toggleSwitch.tag to grab the indexRow but as my indexRow is part of an indexPath.section I am not sure how to tell which row I toggled. Here is the code: - (UITableViewCell *)tableAlert:(SBTableAlert *)tableAlert cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell; Category *cat = [allCategories objectAtIndex:indexPath.section]; Subject *sub = [cat.subjects objectAtIndex:indexPath.row]; cell = [[[SBTableAlertCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease]; UISwitch *toggleSwitch = [[UISwitch alloc] init]; cell.accessoryView = [[UIView alloc] initWithFrame:toggleSwitch.frame]; [cell.accessoryView addSubview:toggleSwitch]; cell.textLabel.text =sub.title; cell.detailTextLabel.text = sub.category_title; if (sub.active==1){ [toggleSwitch setOn:YES]; } e

UITableView&hellip;the correct way

I'm trying to make a UITableView like the native calendar app: but I'm trying to learn the best way to do this. I'm able to get this for the most part with a switch statement in the cellForRowAtIndexPath method, but I'm having troubles changing the textColor when a cell is selected. For some reason cell.isSelected is always NO, and I have no way to reload the tableview after another cell is selected anyway. Should I subclass UITableViewCell for something this simple and store an array of cells? Any help would be appreciated, thanks.

MFMailComposeViewController image attachment and HTML body

Hopefully simple question: Is there a way to attach an image to the MFmailcomposeviewcontroller AND have an HTML formatted body? Everytime I try, I can do one or the other, but not both. If I set isHTML:YES, it gives me the HTML body format, but then it embeds my image attachment (not what I want). If I do isHTML:NO, the image is attached as a file (what I want) but the body message obviously won't respect my br line breaks. Any suggestions?

uitableView reloadData doesn"t work after setting delegate, datasource and file"s owner connection

I have googled and done lot of research from my side to find out why the reloadData method on tableview wouldn't work. I checked all the possible solutions like the datasource is set, delegate is set, the tableview is connected to the file's owner. After all these, when I am trying to reload the tableview, the no. of rows method gets called, but the cell for rowAtIndexPath doesn't get called. Below is the code that I have written. Please let me know, where I am going wrong - (void)onReservationListSuccess:(NSArray *)rData { if ( rData != nil ) { resList = [[NSArray alloc] initWithArray:rData]; if([resList count] > 0) { [self.tripsTableView reloadData]; //[self.tripsTableView beginUpdates]; //[self.tripsTableView reloadSections:[NSIndexSet indexSetWithIndex:0] // withRowAnimation:UITableViewRowAnimationNone]; //[self.tripsTableView endUpdates]; } else { [tripsTableView reloadData];

Is there a better way to embed maps on the iPhone, without using native code?

I have an iPhone application, which does include maps. However, when a user clicks a button in the app - it just brings up an embedded safari browser, with the Google Maps in it. This is because I have a web version of the app, and I want the exact same result on both iPhone and web, without having to constantly update both codes. Also, it includes display of a polygon and pins. Is there a better way to implement Javascript maps on the iPhone in a native app? Or for Javascript to control a native Google map in the iPhone application? I don't really fancy the idea of "translating" all the Javascript code, database lookup etc, into native code. Any ideas?

Phonegap and Admob on iPhone

I am trying to implement AdMob Javascript on a Phonegap mobile application, however when I paste in the code I get a whitelist error in the console leading to mmv.admob.com , so clearly phonegap was blocking communication with this url so I added to phonegaps url exceptions in the plist , this then lead to a blocked communication with the url doubleclick.net so I added *.doubleclick.net so now it has lead to no url errors, just not displaying any ads at all - not even a block colour which it is meant to fallback too. Any ideas to what I am doing wrong? Thanks,

Align UISlider thumb image - objective-c

I've customized my UISlider but my thumb image looks strange, I mean it's position not aligned by center: But should be like this: And here is code: UIImage *leftTrack = [[UIImage imageNamed:@"blueTrack.png"] stretchableImageWithLeftCapWidth:3 topCapHeight:0]; UIImage *rightTrack = [[UIImage imageNamed:@"whiteTrack.png"] stretchableImageWithLeftCapWidth:3 topCapHeight:0]; [slider setThumbImage:[UIImage imageNamed:@"thumbButton.png"] forState:UIControlStateNormal]; [slider setMinimumTrackImage:leftTrack forState:UIControlStateNormal]; [slider setMaximumTrackImage:rightTrack forState:UIControlStateNormal]; Where could be the problem? EDIT: I found solution of this problem. Thumb image background was transparent, and I've not seen that thumb image was not aligned by center:

Smooth code, but SIGABRT

The crash log of SIGABRT from the device is pointing on the lines: NSArray *results = [self.managedObjectContext executeFetchRequest:request &error]; if ([results count] > 0 ) { // SIGABRT on this line. and (for the same device): if (myfunc(myobj)) { // SIGABRT on this line. where myobj is a pointer that must be nil from the app configuration, and it is initialized in the line just before the line of the crash. myfunc is a function looking like: BOOL myfunc(id object) { return object != nil; } so i would consider the second crash as myobj = something if (myobj != nil) { // SIGABRT on this line. My knowledge is not enough to understand the possibility of such crashes (probably they're even random) on certain devices (on the most devices everything works fine and stable). Anyone had such issues or have an experience debugging it ?

Resume Updating views after time is invalidated

Time is invalidated to pause the views from updating because pause button was hit to pause the audio file. Next step is when user hits pause button again to resume audiofile, views should also start updating. -(void)playpauseAction:(id)sender { if ([audioPlayer isPlaying]){ [sender setImage:[UIImage imageNamed:@"play.png"] forState:UIControlStateSelected]; [audioPlayer pause]; [timer invalidate]; } else { [sender setImage:[UIImage imageNamed:@"pause.png"] forState:UIControlStateNormal]; [audioPlayer play]; self.timer = [NSTimer scheduledTimerWithTimeInterval:11 target:self selector:@selector(displayviewsAction:) userInfo:nil repeats:NO]; } } - (void)displayviewsAction:(id)sender { FirstViewController *viewController = [[FirstViewController alloc] init]; viewController.view.frame = CGRectMake(0, 0, 320, 480); [self.view addSubview:viewController.view]; [self.view addSubview:toolbar]; self.timer = [NSTimer scheduledTimerWithTimeInterval:

Blurry images when running my application on iPhone

So, I was creating an application for iOS with Xcode 4.2.1, I don't know why all of my icons are blurry, they are in high definition, but for some reason they looks blurry and in a bad quality. even the background images looks bad.. Please help me, what can I do about it? This is the original button image: This is how it looks on the application:

NSPropertyListSerialization returns nil when trying to convert NSDictionary to NSData

I'm trying to convert an NSDictionary to NSData to store in core data, but I am getting a nil value returned to me. error states 'Unknown format option' after the call. NSString *error = nil; NSData *d = [NSPropertyListSerialization dataFromPropertyList:data format:NSPropertyListImmutable errorDescription:&error]; The data I'm trying to convert is an NSDictionary with NSStrings as keys and values. Here is a dump of the data dictionary: Printing description of data: <CFBasicHash 0xc96fd60 [0x18ecb38]>{type = immutable dict, count = 4, entries => 0 : <CFString 0x17c9fc [0x18ecb38]>{contents = "title"} = <CFString 0xecc8040 [0x18ecb38]>{contents = "test"} 1 : <CFString 0x17ca2c [0x18ecb38]>{contents = "author"} = <CFString 0xc9643f0 [0x18ecb38]>{contents = "test"} 2 : <CFString 0x17ca0c [0x18ecb38]>{contents = "goal"} = <CFString 0xc96f730 [0x18ecb38]>{contents = "te

scaling ccdirector cocos2d

I'm making a pixel art app and the resolution is 320x240. I want to scale some how ccdirector or eaglview to fit full device screen. I tried setContentScaleFactor in ccdirector and eaglview or else eagllayer, but it appears work differently in those cases, and didn't get what I want in any. What is the correct way to do that? Currently I'm scaling the CCScene, but when some sprite isn't in integer number, they stay in the middle of pixel grid, what is not correct.

Create a proxy within the iOS app

I have an app with an UIWebView (which is connected with a website); the user will navigate into the website. After that, I want that when the user open the app and there is no connection, the already visited pages will be accessible. So I though that it should be possible if I create an internal proxy within the app: each request will be processed by this proxy (and will send the result to the UIWebView). Of course, the proxy should cache the web pages and, if there is no connection available, use the cached pages. I prefer this approach instead of others (HTML5 offline cache) because, in the future, I will can set some feature to the proxy, for example "I want to cache all the pictures for the next 5 hours" etc... Do you know if it's possible and, if it is, what should I use to do it? Or... do you know if there is something similar already done (some Objective-C Proxy?) ?

When using GPX in Xcode to simulate location changes, is there a way to control the speed?

I'm using the following GPX file in Xcode 4.2 to simulate a location change. It works well, but I can't control the speed of the location change. stamp seems to be not working. Does anyone have a solution for this? <?xml version="1.0"?> <gpx version="1.1" creator="Xcode"> <wpt lat="37.331705" lon="-122.030237"></wpt> <wpt lat="37.331705" lon="-122.030337"></wpt> <wpt lat="37.331705" lon="-122.030437"></wpt> <wpt lat="37.331705" lon="-122.030537"></wpt> </gpx>

When is it best to do an NSManagedObjectContext save?

I have noticed that for a mobile application, saving on the main thread seems to take a bit when it compares to other applications on the device. Is it recommended to only save Core Data when the application enters the background or when an application closes instead of anytime items are added and sent / received from the api?

MonoTouch - type load exception, updated program not registered in simulator

I've installed trial version of MonoTouch, and I'm evaluating it for use. This strange error has occurred: Could not load 'MyProductName' for registration. This could be due to an outdated assembly kept by the simulator, location: /PathToMyProduct Followed by: A type load exception has occurred. My guess is that, somehow some assembly is not up to date. So I've tried to remove it from the given path. But still it's there. So I performed a purge (reinstalled MonoTouch, removed binary build path, in simulator path, uninstalled from simulator, reset simulator, and finally restarted the OSX). But still it's there. Any hints on how to solve this peculiar problem? regards, Kate

How to push DetailView without NavigationController on UIViewController

I have a ViewBased App. I added a UITableView on one of the UIViewControllers. It shows the data and I implemented all the delegate methods etc. My problem is when I want to show the detailView it just doesn't happen. My code: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { DetailViewController *detailViewController =[[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil]; NSLog(@"DidSelectRowAtIndexPath"); // Pass the selected object to the new view controller. [self.navigationController pushViewController:detailViewController animated:YES]; [detailViewController release]; } I see that I need a navigationController but I don't have one and I was unsucessful trying to add one programatically. I don't have one in my appDelegate either, so my question is do I need to add one to show the detail view? If yes, please give me a code sample

Why is an IBOutletCollection pointing to static cells from storyboard returning null?

I have defined this in code: @property (nonatomic, weak) IBOutletCollection(UITableViewCell) NSSet * certaintyCells; and synthesized. I made absolutely sure that this controller is used in story board, and connected three cells to this collection. Next, in the didSelectRowAtIndexPath: method call, I added this code, with NSLog added for debugging: NSLog(@"Certainty Cells: %@",certaintyCells); for (UITableViewCell * cell in certaintyCells) { [cell.textLabel setTextColor:[UIColor colorWithRed:0 green:0 blue:0 alpha:1]]; [cell setSelectionStyle:UITableViewCellSelectionStyleBlue]; } The output is this: Certainty Cells: (null) And of course, behaviour expected does not happen. Any ideas as to why this is happening? I did make sure that I am using static cells, and not dynamic prototypes. As a side note, these three cells are also connected to (working) IBOutlets of their own. Thanks,

how can I remove the top border on UIToolBar

I have set my UIToolBar tint color to some value, and there is this border line that I see in which I want to remove: How do I remove this black border>