can anyone please help me in getting solution for my question .. i need an sample application with segmented controller built from different view controllers placed inside a scroll view (As like Instagram).
I have developed an app that works fine on iPhone with all versions of iOS.
However in iPad with iOS 8.1.3 I am facing issue. There is a login screen in my app and I am using UITextField to take input from the user. It seems that in iPad these UITextField are disabled (not able to focus) and keyboard is not popping up when I am tapping on those.
When I upgraded my iPad to iOS 8.2 it started working fine.
I want to know that anyone has faced a similar issue like this and what how can I solve the issue ?
I want transform a view along Y axis. My code work fine But they back to its orginal postion after a sec.I am not needed this.
CABasicAnimation* animation =[CABasicAnimation animationWithKeyPath:@"transform.rotation.y"];
animation.fromValue = @(0);
animation.toValue = @( M_PI/4);
animation.repeatCount = 0.0;
animation.duration = 5.0;
[self.view.layer addAnimation:animation forKey:@"rotation"];
CATransform3D transform = CATransform3DIdentity;
transform.m34 = 1.0 / 500.0;
self.view.layer.transform = transform;
I am trying to segue an array filled with Strings from the FactsViewController to the FavoritesViewController, but for some reason when I add some elements to the array, run the code, and transfer to the FavoritesViewController it says there are no elements in the array...
First View Controller:
import UIKit
class FactsViewController: UIViewController {
@IBOutlet var factsLabel: UILabel!
@IBOutlet var nextButton: UIButton!
@IBOutlet var previousButton: UIButton!
@IBOutlet var favoriteButton: UIButton!
var factNumber: Int = 0
var i = 0
var favoriteFactsList: [String] = []
var factsList: [String] = ["Fact 1", "Fact 2", "Fact 3", "Fact 4"]
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
factsLabel?.text = factsList[factNumber]
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// Segue array to Favorites ViewController
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
var destinationViewController: FavoritesViewController = segue.destinationViewController as FavoritesViewController
var arrayToSegue: [String] = favoriteFactsList
destinationViewController.favoriteList = arrayToSegue
}
// Next Button
@IBAction func nextButton(UIButton: AnyObject) {
factNumber++
if(factNumber >= factsList.count - 1) {
factNumber = factsList.count - 1
}
factsLabel.text = factsList[factNumber]
}
// Previous Button
@IBAction func previousButton(UIButton: AnyObject) {
factNumber--
if(factNumber <= 0) {
factNumber = 0
}
factsLabel.text = factsList[factNumber]
}
// Favorite Button
@IBAction func favoriteButton(UIButton: AnyObject) {
favoriteFactsList.append("\(factsList[factNumber])")
NSLog(String(favoriteFactsList.count))
}
// Present Favorites ViewController
@IBAction func favoritesViewController(UIButton: AnyObject) {
let favoritesViewController = self.storyboard?.instantiateViewControllerWithIdentifier("favoritesStoryBoard") as FavoritesViewController
self.presentViewController(favoritesViewController, animated: true, completion: nil)
}
}
Second View Controller:
import UIKit
class FavoritesViewController: FactsViewController {
@IBOutlet var favoriteFactsLabel: UILabel!
@IBOutlet var favoriteNextButton: UIButton!
@IBOutlet var favoritePreviousButton: UIButton!
var favoriteList: [String] = [String]()
var favoriteFactNumber: Int = 0
override func viewDidLoad() {
super.viewDidLoad()
factsList = favoriteFactsList
NSLog("\(favoriteFactsList.count)")
if(favoriteList.count == 0) {
favoriteFactsLabel.text = "Sorry, You Have Not Favorited Any Facts Yet"
favoriteNextButton.hidden = true
favoritePreviousButton.hidden = true
}
}
@IBAction func favoriteNextButton(UIButton: AnyObject) {
favoriteFactNumber++
if(favoriteFactNumber >= favoriteList.count - 1) {
favoriteFactNumber = favoriteList.count - 1
}
favoriteFactsLabel.text = favoriteList[favoriteFactNumber]
}
@IBAction func favoritePreviousButton(UIButton: AnyObject) {
favoriteFactNumber--
if(favoriteFactNumber <= 0) {
favoriteFactNumber = 0
}
favoriteFactsLabel.text = favoriteList[favoriteFactNumber]
}
override func favoriteButton(UIButton: AnyObject) {
favoriteList.append("\(factsList[factNumber])")
}
@IBAction func returnButton(UIButton: AnyObject) {
let factsViewController = self.storyboard?.instantiateViewControllerWithIdentifier("factsStoryBoard") as FactsViewController
self.presentViewController(factsViewController, animated: true, completion: nil)
}
}
Why will my facts array not segue from the FactsViewController to the FavoritesViewController?
I am a beginner and I am a bit confused about UIScrollView. Here is my case.
Without UIScrollView, I added and made stuffs on UIViewController.
Later on, I realized I have to implement UIScrollView, and now I have to migrate all my contents to inside of the UIScrollView.
If I drag out UIScrollView from storyboard and move all my elements into that scrollview,
I am guessing the order of contents would be:
from: UIViewController -> IBOutlets
to: UIViewController -> UIScrollView -> IBOutlets
Thus, do I have to change the way I access IBOutlets on my view controller?
Will this be the correct way?
before:
@property (strong, nonatomic) IBOutlet UILabel *coursenameLabel;
and access:
_coursenameLabel.text = @"text";
after:
@property (strong, nonatomic) IBOutlet UIScrollView *scrollView;
@property (strong, nonatomic) IBOutlet UILabel *coursenameLabel;
and access like this?
_scrollView.coursenameLabel.text = @"text";
Would this be the simplest way to move all my contents to inside of UIScrollView?
I have got a problem while receiving incoming call.
I can able to receive incoming call and it automatically answers the pjsip VoIP call .
and I need a module when user can manually pic the call on button click .
This is where i am receiving incoming calls
static void on_incoming_call(pjsua_acc_id acc_id, pjsua_call_id call_id,
pjsip_rx_data *rdata){
pjsua_call_info ci;
PJ_UNUSED_ARG(acc_id);
PJ_UNUSED_ARG(rdata);
pjsua_call_get_info(call_id, &ci);
PJ_LOG(3,(THIS_FILE, "Incoming call from %.*s!!",
(int)ci.remote_info.slen,
ci.remote_info.ptr));
[[NSNotificationCenter defaultCenter] postNotificationName:@"appDidBecomeActive" object:nil];
/* Automatically answer incoming calls with 200/OK */
pjsua_call_answer(call_id, 200, NULL, NULL); }
What should i do that i can show an incoming call view there ( a button to pick up call and a button to hang up call ) .
Thanks in advance and please help me .