Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

arme

macrumors member
Original poster
Sep 15, 2008
48
0
Hi
please help me in iPhone programming.
I need a project for login. I can't write a code for interface that use a username and password for login
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
Right, I'm taking pity on you despite your spamming.

To get help we need to know what you've done and what isn't working.

Post all the relevant code you've written (use code tags). If there is an interface you've designed in Interface Builder either post a screen shot or describe it and tell us ALL the connections you've made in IB. Describe what you think the code will do. If it crashes tell us where and post the crash details. If it "doesn't work" tell us what it does and how this differs from your expectations.

We're not about to write all your code from scratch, we might help you debug/fix your code. You need to help us help you.

Edit to add: And don't post stuff in other peoples threads that is not 100% to do with what they've asked. It's rude, arrogant and discourteous
 

arme

macrumors member
Original poster
Sep 15, 2008
48
0
tell me is there interface like visual .net2005 for design interface?
if there is please me how i can use?

in many of document tell we can add objects into my interface but i can't use .
.nib file don't have visual interface for add objects like button ,...

i do create interface in first level that get user and pass then check is true. now i don't need connection. for example user "a" and pass "123" can connect to url "x"
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
tell me is there interface like visual .net2005 for design interface?
if there is please me how i can use?

If you are at that stage I suggest that you need to go right back to the start and read the documentation/tutorials and learn what you are doing. I am not going to spoon-feed you every tiny bit of information.

Sign into the iPhone Developer site at developer.apple.com, watch the videos, read the getting started documents, download the samples and understand them, then come back and ask detailed questions about specific issues you are having with your code.
 

arme

macrumors member
Original poster
Sep 15, 2008
48
0
This is my code that run but show white screen.


#import <UIKit/UIKit.h>


@interface myView : UIView {
UILabel *touchPhaseText;
}
@property (nonatomic, retain) UILabel *touchPhaseText;

@end


#import "myView.h"



@implementation myView
@synthesize touchPhaseText;

- (id)initWithFrame:(CGRect)frame {

if (self = [super initWithFrame:frame]) {

self.backgroundColor =[UIColor blackColor];

// Set up a text label to show the touch phase.
// Create and inialize the label.
touchPhaseText = [self newLabelWithOffset:(self.frame.origin.y + 25) numberOfLines: 1];
// Set the default text that shows on startup.
touchPhaseText.text = @"Touches lets you observe touch";
// Add the label as a subview.
[self addSubview:touchPhaseText];
}
return self;
}

-(UILabel *) newLabelWithOffset:(float)offset numberOfLines:(NSUInteger) lines
{
float textHeight = 20.0;
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(self.frame.origin.x + 10.0, offset, self.frame.size.width - 20.0, textHeight * lines)];
// Set the font size, text color, background color, and alignment.
label.font = [UIFont systemFontOfSize:18.0];
label.textColor = [UIColor lightTextColor];
label.backgroundColor = [UIColor clearColor];
label.textAlignment = UITextAlignmentCenter;
// Set the number of lines
label.numberOfLines = lines;
if (lines > 1)
// Set the linebreak mode if there is more than one line.
label.lineBreakMode = UILineBreakModeWordWrap;
// Initialize as an empty string
label.text = @"";
return label;

}


- (void)drawRect:(CGRect)rect {
// Drawing code
}


- (void)dealloc {
[super dealloc];
}


@end
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
1) Use code tags. It makes the code readable on the forums.

2) How is this view created? In Interface Builder? In your application delegate? Are you 100% sure it's been added to a UIWindow which is visible?
 

PhoneyDeveloper

macrumors 68040
Sep 2, 2008
3,114
93
A few suggestions: Read the iPhone OS Programming Guide, Your First iPhone Application, Interface Builder User Guide (at least the sections on iPhone), and View Controllers programming Guide. Then look at some of the sample code. UICatalog shows how to put most of the UIKit controls on the screen.

Your design is odd. It usually makes no sense to have a UIView subclass that has an empty drawRect method.

You need to come up to speed on more things before anyone can really help you get going.
 

Sbrocket

macrumors 65816
Jun 3, 2007
1,250
0
/dev/null
Your design is odd. It usually makes no sense to have a UIView subclass that has an empty drawRect method.

Just a note - that's probably just leftover template code that he hasn't removed yet, rather than anything he added.

@arne: In the future, please wrap any code that you enter on these forums in [ CODE][ /CODE] tags (minus the spaces) as it makes it much, much easier for anyone trying to help you. You're a lot more likely to get help when any code you post here is actually readable.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
Just a note - that's probably just leftover template code that he hasn't removed yet, rather than anything he added.

Whilst that may be true nothing in there needs to be a custom UIView. There's a background colour and a subview. A plain old NSView would work fine.
 

Sbrocket

macrumors 65816
Jun 3, 2007
1,250
0
/dev/null
Whilst that may be true nothing in there needs to be a custom UIView. There's a background colour and a subview. A plain old NSView would work fine.

It looked to me like he was trying to implement the interface programmatically because, from what I gathered, he can't figure out how Interface Builder works (hence "in many of document tell we can add objects into my interface but i can't use .....nib file don't have visual interface for add objects like button ,...")

In that case, a UIView subclass is the right way to go about it, but in the grand scheme of things it depends on what he's really trying to do - implement the interface in code, or implement it using Interface Builder.

One note I'll make to arne that you might not have caught onto yet - Interface Builder is not a code generator. Building your interface in a nib will not generate interface code - nibs archive the objects themselves, and the archive is then parsed and unarchived at application load. I suggest taking a look through Apple's extensive documentation if you have any other questions about it.
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
In that case, a UIView subclass is the right way to go about it,

You and I will simply have to disagree on that one (no point taking this more off topic than it already is). There is no reason for that subclass. It would be easier and simpler just to instansiate a UIView in code, set it's background colour and then add the UILabel as a subview. No need for the subclass and therefore less code so less chance for error.
 

Sbrocket

macrumors 65816
Jun 3, 2007
1,250
0
/dev/null
You and I will simply have to disagree on that one (no point taking this more off topic than it already is). There is no reason for that subclass. It would be easier and simpler just to instansiate a UIView in code, set it's background colour and then add the UILabel as a subview. No need for the subclass and therefore less code so less chance for error.

Well, right, that's how I (would) do it too, but in terms of proper Model-View-Controller separation you'd want to have a separate UIView subclass for the view. Otherwise your construction of the view would probably be mixed in with the controller, and it would be more Model-View & Controller. With strict MVC, that would be wrong.

Of course its up to the programmer or whoever they work for to determine what code practices to follow. I certainly don't obey strict MVC because, like you, I think its a bit redundant.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.