How can you search a UITextFields in UIScrollView [closed] - iphone

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have UIScrollView. It added several UIView. In UIView TextField added. How do I add all the TextField array?
for (int i=0; i < numMaysDayVal; i++) {
backView = [[UIView alloc] initWithFrame:CGRectMake(0, (60*(i)), 320, 60)];
myTextField = [[UITextField alloc]initWithFrame:CGRectMake(0,15, 300, 35)];
myTextField.delegate = self;
[backView addSubview:myTextField];
[self.scrollView addSubview:backView];
scrollHeight = i;
}
[self.scrollView setContentSize:CGSizeMake(320, scrollHeight*60 + 80)];
}

What do you really want? You added them already as far as I can see.
Do you mean by "search them" that you want to refer to them later on (e.g. to fetch the values)?
If so then there are several possible solutions.
You could add a NSMutableArray as local variable to your view controller to which you add all the text fields.
Or you assign 10000+i as tag to the text fields (myTextFild.tag = 10000+i). And later search for the text view by their tag (self.scrollview.viewWithTag(10000+i). Why 10000+i? That is because the default value for tag is 0. If you start off setting tags to the subviews with i only then it would be hard to identify the one with the tag 0 because all the other subviews of the scrollview would have that value too.

Related

Need to apply gesture in label view at fix corner point like ZDStckerView in objective c in iphone [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
i want to implement text on image with resizing feature like i can zoom text field or label in or out by clicking a corner point of label...and i want to save that text on image view...
i refer sticker view ...but the label inside image does not zoom in or out...
code :
//add a label inside imageview
UILabel *lb1 = [[UILabel alloc ] initWithFrame:CGRectMake(0,0,320,40)];
UIimageview *imgview_sign = [[UIImageview alloc ] initWithFrame:CGRectMake(0,0,320,140)];
[imgview_sign addsubview:lbl1];
//add aZDSticker view
ZDStickerView *userResizableView = [[ZDStickerView alloc] initWithFrame:imgview_sign.frame];
userResizableView.tag = 0;
userResizableView.delegate = self;
userResizableView.contentView = imgview_sign;
userResizableView.preventsPositionOutsideSuperview = NO;
[userResizableView showEditingHandles];
[self.view addSubview:userResizableView];
//Imageview is zoomed properly in or out but my label is not zomming....i want to apply gesture on label also ...
You can try to draw text on uiimage, this should work.
Check this answer: https://stackoverflow.com/a/12578118/2298998

How to enter text in textfield from 5 pixels after in ios [duplicate]

This question already has answers here:
Set padding for UITextField with UITextBorderStyleNone
(32 answers)
Closed 9 years ago.
I have UITextField of which I've added an image.
Everything looks good, except that the text starts from zero X-coordinate, but I want it to start after 5 pixels in text field.
put a left view into your text filed as such :
textField.layer.cornerRadius = 5.0;
UIView *paddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 5, textField.frame.size.height)];
textField.leftView = paddingView;
[paddingView release];
textField.leftViewMode = UITextFieldViewModeAlways;
Simplest Answer :
1) Take one UIImageView. Add that Image for UITextField in UIImageView.
2) Add UITextField with "No Border" above that UIImageView (5 Pixels Right on that UIImageView).
GoodLuck !!!
Simple way to do this.
Add an image of your textfeld
Add an uitextfield with custom type
set frame of the added uitextfield & move 5 pixels at right than the image
Checkout attached image for a detailed knowledge
Enjoy Programming !
Try to use this one
UIImageView *imageView = [[UIImageView alloc] init];
// add 5 (width) pixel for your space
imageView.frame = CGRectMake(0,0 ,5, txtFld.frame.size.height);
txtFld.leftViewMode = UITextFieldViewModeAlways;
txtFld.leftView = imageView;
And see in this image for more info.

UITextView text colour not changing [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
I'm trying to programatically change the colour of a UITextView, however it doesn't seem to update. I have defined an IBOutlet in a view controller class, and then added the relevant connections in Storyboards. In the viewDidLoad: method, I have:
[super viewDidLoad];
[helpText setBackgroundColor:[UIColor clearColor]];
[helpText setTextColor:[UIColor whiteColor]];
however, the text colour remains the same (Black). Any ideas?
Sorted it:
I had a method called -setHelpText: which took the text to put in the helpText UITextView, however doing this (having a setter with the same name as an IBOutlet) causes a nil object to be created. Refactored the method name to something else and all is well :)
First Check Your UITextView add as Proper or not ???
Check that #property and #synthesize is proper or not??
You can also try with
helpText.textColor = [UIColor whiteColor];
Another way is
UIColor *myColor = [UIColor colorWithHue:0.38 saturation:0.98 brightness:1.0 alpha:1.0];
[helpText setTextColor:myColor];
UITextView *t = [[UITextView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
[lbl setTextColor:[UIColor blueColor]];
[self.view addSubview:txtView];

custom iCarousel for Iphone? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
In my app i want to implement an iCarousel for displaying view controllers like in the below image,i was gone through about many tutorials and links but iam not getting my requirement ,help me please
It is known as coverflow in iOS. Follow this link you will get what you wanted and will come to know how to implement it.
Or you can refer this question on stack overflow too. and here is accepted answered of mine
You can use iCarousel for the same effect
from below link download sample code for the carousel effect.
https://github.com/nicklockwood/iCarousel
There is one example in No Nib Folder.
Open it & modify following code according to your requirement
//in iCarouselExampleViewController.m
In the below method modify there code as per your need.By adding different UI on the main view you can design your required UI.
In my case I have added one image & label on that main view.
- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view
{
UILabel *label = nil;
UIImageView *imageLogo=nil;
UIImageView *imageBack=nil;
//create new view if no view is available for recycling
if (view == nil)
{
view = [[[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:#"page1" ofType:#"png"]]] autorelease];
imageBack=[[[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:#"3" ofType:#"png"]]] autorelease];
imageBack.frame=CGRectMake(70, 70,388, 49);
[view addSubview:imageBack];
label = [[UILabel alloc]initWithFrame:CGRectMake(80, 78, 380, 30)];
label.backgroundColor=[UIColor darkGrayColor];
label.font = [label.font fontWithSize:20];
label.backgroundColor=[UIColor clearColor];
[view addSubview:label];
imageLogo=[[[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:#"Map" ofType:#"png"]]] autorelease];
imageLogo.frame=CGRectMake(25, 70, 50, 49);
[view addSubview:imageLogo];
}
else
{
label = [[view subviews] lastObject];
}
label.text = #"Some text";
label.frame=CGRectMake(label.frame.origin.x, label.frame.origin.y, label.frame.size.width,label.frame.size.height);
return view;
}
}
iCarousel is used to display views, not view controllers.
There is no need to have an array of view controllers for what you are attempting to do - since all of your views behave the same way you can put your control logic in one view controller that manages the carousel and have any buttons in your carousel views call methods on your primary view controller, using the item index to determine which carousel item was pressed.
There are several example included with iCarousel that show how to do this, including the controls example which shows how to load individual carousel views from a nib file and bind their actions to the main view controller.
Try iCarousel for iOS it's better way to use easy to implement more carousel effects like vertical and horizontal.below links for download and implementation tutorial.
iCarousel demo project below link:
https://github.com/nicklockwood/iCarousel
iCarousel horizontal scroll implementation tutorial below link:
http://haifa.baluyos.net/index.php?option=com_content&view=article&id=60:objective-c-image-carousel-tutorial&catid=1:programming&Itemid=5

How to change didSelectRow Color from blue to orange? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Cell have already an image (of size 320 * 103) and text "Highs And Lows from The 'Raly To Restore Sanity And...." as shown in first cell.
My problem is that when I select any row for navigating to the detailsViewController the cellimage(of size 320 * 103) color should be change as like shown in below imageColor(orange color) (eg. third row). How can I do this?
Try this code:--
put the code inside the given method
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UIView *myBackView = [[UIView alloc] initWithFrame:cell.frame];
myBackView.backgroundColor = [UIColor colorWithRed:253.0/256.0 green:199.0/256.0 blue:235.0/256.0 alpha:1.0];// change the color to your orange color i used different color herer
cell.selectedBackgroundView = myBackView;
[myBackView release];
}
UIView *cellBgView = [[UIView alloc] initWithFrame:cell.frame];
cellBgView.backgroundColor = [UIColor orangeColor];
cell.selectedBackgroundView = cellBgView;
[cellBgView release];
First, you need to set backgroundView as others said.
Second, when the cell is selected, it will call -(void)setSelected:animated: and -(void)setHighlighted:animated: of UITableViewCell. I suppose your cell is custom, subclassing from UITableViewCell.
I like to override the -(void)setHighlighted:animated: method, and inside the method, I will do following things.
-(void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated
{
[myLabel setHighlighted:highlighted];
[myIconImage setHighlighted:highlighted];
///.... propagate the highlighted event to subviews.
// Call super method.
[super setHighlighted:highlighted animated:animated];
}