cocoa-touch

Overlapping and touching CoreGraphics rectangles have a .5px border

My core graphics fills are acting strange when the get close together, touching or overlapping. This issue is on the iPhone Simulator and iPhone OS 2.2. Here we have two labels and a custom view with two CGContextFillRect(): overlap problem When the blue and red are brought together they develop this irritating .5px merging line. I c...

Add a navigation item to a view contoller

Hi, I had a Navigation Controller based application and decided to use tab bars. And in some views I don't need to have a navigation controller assigned to a view controller but I still want to have an "add" button at the right top corner of my view. What is the easiest view to accomplish this? I tried to add a navigation item to my vi...

UITableView - add cells

I have a UITableViews inside of a TabBarController that are populated with separate arrays of data. Due to web syncing, this array updates, and I'd like to update the table. Calling: [self.tableView reloadData] will reload content in existing cells, but I need to add cells for the new data. It seems that this method is not calling -...

UIView scaling during animation

I've got a custom UIView to show a tiled image. - (void)drawRect:(CGRect)rect { ... CGContextRef context = UIGraphicsGetCurrentContext(); CGContextClipToRect(context, CGRectMake(0.0, 0.0, rect.size.width, rect.size.height)); CGContextDrawTiledImage(context, imageRect, ima...

Why does popViewController only work every other time

I am totally stumped, here's the situation: My app uses the Core Location framework to get the current location of the user and then pings my server at TrailBehind for interesting places nearby and displays them as a list. No problems. To conserve batteries, I turn off the GPS service after I get my data from the server. If the user ...

Open a view in UITabBarController

Hi, I need to open programatically a certain tab in my tab bar. I tried calling the following method from my UITabBarController: self.selectedViewController = myVController; Which doesn't work. What is the right way to open a tab? Thank you. Update: I tried the following code: self.selectedViewController = [ [self viewController...

Add CALayer as sublayer and then animate

Hi, here is what I want to do: Add a CALayer as a sublayer to antoher layer and then immediately animate it. The layer is added with it's position outside the current view and should "fly" into the view. This all takes place in a UIViewController. Here's how my code basically looks like: mysublayer.position = CGPointMake(-160.0, -250.0...

Add a picture to UITabBar

Hi, I have view controllers added to my UITabBarController in the interface builder. How can I add a picture and change item title programmatically? ...

Reference multiple sqlite tables on iPhone?

I don't have enough "Stack Overflow fu" yet to have found a previous answer to this. One of my apps has its data in a SQLite database and I've used the Apple SQLiteBooks sample as primary inspiration -- however, SQLiteBooks has only a single table and a single view. I've got multiple (related) tables accessed as distinct views in a tab ...

NSHost taking an awfully long time

I have an iPhone app that is a client for an existing server application. I am using the following code to connect, and this code was working fine. Today I started work on the project, and something odd is happening. When I click "Connect" NSHost takes about 30-45 seconds to resolve and connect to the host. Once the connection is estab...

How do you sync a Core-Data application between a Mac and a iPhone?

Just wondering what code I would need to do this? ...

Taking an RGB color and normalizing it with UIColor on the iPhone

Hey all, I'm looking for a straight forward way to convert a color from RGB, grabbing it from a tool like Photoshop, then convert it to a UIColor. Since UIColor uses normalized gamut of 0.0 to 1.0 for each color space, I'm not sure how this is done. Thanks for the solution. ...

Iphone UIButton not working

This is so damn simple im sure! Im missing something and im exhausted from trying to fix it. hopefully someone can help. The Button in CharacterView.m works but the button nested down in CharacterMale.m does not. I'm not using IB everything is done progmatically. CharacterView.m is being used as a container ///////////////////////////...

How not to let user choose a certain TabBarItem

Hi, When a user wants to choose a certain UITabBar item, I want first to check if he can choose it. And if he cannot, then show an alert. There is a delegate method that is being raised when a user chooses a certain item, but it doesn't work when an item is disabled. What is the best way to achieve this? Thanks. ...

Code for syncing the iPhone with REST-servers

Hey, is there any open source code for syncing an iPhone with a server (preferably REST)? Found nothing on github and google code. Regards... ...

What type of iPhone application file should I use?

What type of iPhone application file should I use? Before, I was trying to make an application that gets information from an RSS, then populates a tableview. The application would be using a Tab Bar, and have many different views. Before I tried using a "Tab Bar Application" but I did some stuff wrong (I am not sure what) and I had to...

Why can't I correctly parse this date string with NSDateFormatter?

I'm trying to parse a string that was generated by an NSDateFormatter using another NSDateFormatter with the same format. Rather than trying to make that previous sentence make sense, here's some code: NSDateFormatter *format = [[NSDateFormatter alloc] init]; [format setDateFormat:@"MMM dd, YYYY HH:mm"]; NSDate *now = [[NSDate alloc] ...

How does an underscore in front of a variable in a cocoa objective-c class work?

I've seen in a few iPhone examples that attributes have used an underscore _ in front of the variable. Does anyone know what this means? or how it works? an interface file I'm using looks like: @interface MissionCell : UITableViewCell { Mission *_mission; UILabel *_missionName; } @property (nonatomic, retain) UILabel ...

Does anyone know a good tutorial for Tab bars?

Does anyone know a good tutorial for Tab bars? My app is currently a "view-based" app. I need a tutorial on how to make it so that my main nib loads the view from other nibs, and when I click different tabs, it loads other nibs. Thanks ...

How to create a horizontal scrolling view on iPhone???

I want to create a horizontal scrolling field at the top of a UITableView (something similar to what can be found on the Home section of the Facebook App). I want the scrolling field to be filled with six sections where only one section could be selected at a time? How should i do this? I know i should create a UIScrollView and set i...