Making button click different options within UIWebView in Xcode - ios

I have a view controller set up with a tab bar and webView. I need to make it like that when I press the "ATC" button in the bottom of the webView, it will choose the size that the user puts in the first page, then click the "Add To Cart" button on the website. Please let me know if you need more info. Thanks in advance.
Images in dropbox links below
https://www.dropbox.com/s/he0v3m39214a6qj/Screen%20Shot%202014-09-17%20at%209.44.33%20PM.png?dl=0
https://www.dropbox.com/s/3fuvbrixlo6y5ox/Screen%20Shot%202014-09-17%20at%209.44.41%20PM.png?dl=0

In .h file do like this
#property (retain, nonatomic) IBOutlet UIButton *btnATC;
- (IBAction)btnATCPressed:(id)sender;
In .m file viewDidLoad do like this
self.btnATC.hidden = NO;
and ask size for your shoe then hide your button
- (IBAction)btnATCPressed:(id)sender
{
// ask size for your shoe ......
self.btnATC.hidden = YES;
}

Related

JTcalendar in IOS

I am trying to use JTcalendar library to build a custom calendar. In the current implementation , the scroll happens when the user swipes on the screen. I need two buttons left and right to support the scroll feature.
To do this , I have added two buttons in the menu bar for left and right scroll and tried to call the viewDidScroll() function on click of either. However this is not working.
Can anyone please point me in the right direction? I can share the current implementation if needed.
Using the above suggestions, this is how I was able to do this.
The contentView that I am using is from manager object as it is available in my MenuView Class. So this is now the shared contentView.
On this I have called loadpreviouspageWithAnimation and LoadNextPageWithAnimation.
Like So,
- (void) leftAction {
[_manager.contentView loadPreviousPageWithAnimation];
}
- (void) rightAction {
[_manager.contentView loadNextPageWithAnimation];
}
Where the _manager object is already available in the menuView and leftAction and RightAction are the target methods for the buttons.
Thanks!!
You have define somewhere JTHorizontalCalendarView object like below line of code.
#property (weak, nonatomic) IBOutlet JTHorizontalCalendarView *calendarContentView;
So for next month
[_calendarContentView loadNextPage];
For previous month
[_calendarContentView loadPreviousPage];

How to make an animated button in Apple WatchKit?

I'd like to make a button with animation in WatchKit, but it seems I can't find a way to modify WKInterfaceButton or drag an image into button in storyboard. Any help is appreciated.
After some research I found the solution, it's pretty simple but easily ignored :)
First, drag a button into a scene created in storyboard.
Second, select button, modify its property content from Text to Group. If you can't find content property, click the Attributes Inspector button at top right of your screen, it looks like a breakpoint button or a down arrow with a bar.
Now you can control group created inside your button. You need to add a reference of this WKInterfaceGroup inside your controller code. Here is an example:
#interface AAPLButtonDetailController()
#property (weak, nonatomic) IBOutlet WKInterfaceGroup *buttonGroup;
#end
#implementation AAPLButtonDetailController
- (instancetype)init {
self = [super init];
if (self) {
// Initialize variables here.
// Configure interface objects here.
[_buttonGroup setBackgroundImageNamed:#"Bus"];
[_buttonGroup startAnimating];
}
return self;
}
So the button animation will be played after scene initialized. Remember only frame animation is supported for now, all frames in one animation should be named like "Bus0.png", "Bus1.png"....
Hope this can help :)
Reck's post worked for me in instances that I needed to control the repeat count or duration. If you simply want to start or stop an animation for a button, the following works for me, where twoButton is a WKInterfaceButton and I have a set of images name Bus0#2x.png, Bus1#2x.png, etc.
- (void)startButtonAnimating
{
// This works, but can't control repeat counts or duration
[self.twoButton setBackgroundImageNamed:#"Bus"];
// But you can stop after a delay by setting background image nil
[self performSelector:#selector(stopGroupButtonAnimating) withObject:nil afterDelay:1.5];
}
- (void)stopButtonAnimating
{
[self.twoButton setBackgroundImage:nil];
}

Change Background Image of an iOS app with a button click

Title pretty much says it all, I am new to Xcode and am trying to make a button that changed the view's background image. I will have three button and when you click one they will change the background that is associated with the button. How would I accomplish this? I have looked around but have not found anything relevant or anything that worked..
Thanks in advance!
EDIT::
As for what I have, I have a project set up with a window and one view with a background image called "default#2x-568h#2x.png" I would like to be able to press a button and have it switch to "second.png". I have a button and I control dragged into my .h which made this:
#interface TeslameterViewController : UIViewController <CLLocationManagerDelegate> {
IBOutlet UIButton *button1;
}
- (IBAction)button1:(id)sender;
#end
thats where I am lost.
EDIT AGAIN:
Found the fix via this video:
http://www.youtube.com/watch?feature=player_embedded&v=iKuGiJMgMiQ
On the button Action event add this line.
(void)Action:(UIButton *)sender
{
UIGraphicsBeginImageContext(self.view.frame.size);
[[UIImage imageNamed:#"bg.png"] drawInRect:self.view.bounds];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
self.view.backgroundColor = [UIColor colorWithPatternImage:image];
}
try this:
self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"imageName.png"]];
and also see UIView Image Background for example project with complete code...
You need to be more specific on what you need.
Within your xib file, create a UIImageView and stretch its dimensions to fit the size of the screen. Also create a the necessary buttons. Create properties in your view controller to have a reference to the UIImageView and the buttons. Give the buttons an action that changes the picture that the UIImageView loads.
You have to create three buttons in nib file and add outlet to your view controller.
To create outlet you have right click on button then you will get list of event, then control drag to your view controller header file, then one small window will pop up, write method name and click enter. Now u will see method in your controller.write code to change background of button or your view in that method.
for more details:http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphone101/Articles/05_ConfiguringView.html

UITextView link is clickable, but when I click it, Safari doesn't open

I have set this two important variable for clickable link, but when I click the content link in the UITextView, Safari doesn't open.
Anybody know what the problem is?
#property (strong, nonatomic) UITextView *attachmentDescription;
{
self.attachmentDescription.editable = NO;
self.attachmentDescription.dataDetectorTypes =UIDataDetectorTypeLink;
}

Change image when button is pressed

In the app I have six buttons and when any of these buttons are pressed I want the image in the center of the screen to change to a different image but just for the time that any of the six buttons are being pressed. I am really struggling with this and all help would be appreciated. I am using a .xib file. Thanks again guys I am tearing my hair out with exasperation.
Thanks!
You need to have a responder(s) in your viewcontroller that is linked to all the button(s) on the viewcontroller through interface builder. In IB, to link a button to a method make sure the method is in your viewcontroller.h file and also implemented in the .m file. Then go to the connections panel in IB (after clicking on the button) and drag a connection from 'Touch Up Inside' (touch up inside is when a user touches the button and releases that touch up and inside the button's boundary) to the viewcontroller.xib window onto the file's owner icon. From there you will be presented with a drop down menu that will let you choose the IBAction methods you specified in the header file.
In this case take:
- (IBAction) buttonPressed: (id) sender; // header file
- (IBAction) buttonPressed: (id) sender { // .m file
// when the button is pressed then change the uiimageview
[imageView image: [UIImage imageWithContentsOfFile: #"image.png"]];
}

Resources