Is it possible to code this sequence of events once an iPhone app has been launched?
User launches application.
AppDelegate.m checks if data is present in internal database.
If yes, MainWindow.xib loads.
If no, AnotherViewController.xib loads.
I've only seen app examples that load the MainWindow.xib without conditions.
If it is possib...
1) What is the real definition for Action delegate? some definitions describe it is as polymorphic conditional map , some say it *Applied decision Table *.
(You may ask what will you achieve by knowing definition , if i know it i can understand its real purpose).
2) Thanks Binary Worrier,Andrew Hare of stackoverflow for giving nice ex...
I'm using the delegate pattern for one of my objects. My idea is that I will be able to swap the delegate out later for a different delegate implementing a different strategy. I suppose this is just as much the strategy pattern as the delegate pattern.
My question is, is it bad practice for my delegate to have a reference back to the ...
I was just reading a page on events on MSDN, and I came across a snippet of example code that is puzzling me.
The code in question is this:
// Make a temporary copy of the event to avoid possibility of
// a race condition if the last subscriber unsubscribes
// immediately after the null check and before the event is raised.
EventHandle...
According to the definition of action delegate it does not return value but passes value.
I pass the value to Console.WriteLine( )
Action<int> an = new Action<int>(Console.WriteLine(3000));
But still i receive error as method name expected.What is the problem?
...
Goal :
My intention to design a utility that could access any numeric values( int,double,byte...)
and produce the squares.
What i did:
delegate void t<T> (T somevalues);
class program
{
static void Main()
{
Console.ReadKey(true);
}
}
class Utility
{
public static void Activities<T>(T[] So...
Inside main i declared a local int[] array (int[] nums). I did not pass it by reference.
But when i print values of local array i get squared value of each element.
What is the reason for that?
delegate void tsquare(int[] a);
static void Main()
{
int[] nums = { 1, 2, 3 };
tsquare sqr = new tsquare(SomeClass.Square);
sq...
I have a UITableView instance variable. I want to be able to register my view controller to be the UIScrollViewDelegate for my UITableView controller. I have already tried
tableView.delegate = self;
But when scrolling, my methods
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
- (void)scrollViewDidEndDragging:(UISc...
I'm not entirely sure the title is properly worded, but here's the situation... I noticed today while trying to create a generic save function for Linq to Sql that when I use lambda against a data context select. It breaks within a generic function with a type constraint of another generic interface. However, it works fine with LINQ syn...
Hi,
I'm seriously losing my hair because of simple task which turned to hell. So I have UIScrollView subclass - MyScrollView and UIViewController subclass StoryViewController using that scroll view. I need to know when scroll is scrolled so what do I do? I try to delegate!
// StoryViewController.h
@interface StoryViewController : UIVie...
Hi,
Suppose I have thread 1, the main window UI thread and thread 2, a login UI thread that is modal form.
Now thread 1 executes a piece of code and wants to change a UI element in the login form so it invokes a delegate to change something in thread 2. But when it does so, the login form becomes hidden behind the main window and there...
I've got two controls on an iPhone screen - a TableView and a UIPickerView. When you select the single cell in the TableView you're taken to another screen where you're show a list of clothing types. Selecting a single clothing item from the list takes you back to the first screen. Based on your selection, the number of components in the...
I have the following method I can pass in a lambda expression to filter my result and then a callback method that will work on the list of results. This is just one particular table in my system, I will use this construct over and over. How can I build out a generic method, say DBget that takes a Table as a parameter(An ADO.NET dataservi...
Hi,
I realize the title needs to be read more than once for understanding ... :)
I implemented a custom attribute that i apply to methods in my classes.
all methods i apply the attribute to have the same signature and thus i defined a delegate for them:
public delegate void TestMethod();
I have a struct that accepts that delegate as ...
I think this is the question, anyway. I am using a RelayCommand, which decorates an ICommand with two delegates. One is Predicate for the _canExecute and the other is Action for the _execute method.
---Background motivation --
The motivation has to do with unit testing ViewModels for a WPF presentation. A frequent pattern is that I hav...
I've been searching the Web, including MSDN.com for a easy-to-understand explanation of delegates in c#. There's plenty of tutorials/lessons...but its a hard concept for me to grasp. So i thought I'd ask fellow programmers. Can anyone explain?
...
I have created a variable in my App Delegate and from my first View Controller, I am saving a value to the variable (in the App Delegate).
Here is how I'm saving the value to the variable in the App Delegate:
MyAppDelegate *DelegateVar = TheValue;
NSLog(@"%@", DelegateVar); // This NSLog outputs correct value
Later in the program, i...
Hi,
When passing a delegate to the a NSUrlConnection object like so:
[[NSURLConnection alloc] initWithRequest:request delegate:handler];
when should you call release on the delegate? Should it be in connectionDidFinishLoading? If so, I keep getting exec_bad_access. I'm seeing that my delegates are leaking through instruments.
Than...
I have this subclass of UIScrollView:
@interface MyScrollView : UIScrollView <UIScrollViewDelegate>
And I have those delegate methods
- (void)scrollViewDidEndZooming:(UIScrollView *)aScrollView withView:(UIView *)view atScale(float)aScale{
NSLog(@"zoomed");
}
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)aScrollView{
...
Hi all,
An asynchronous question:
I've been reading over the internet LOTS of articles for and against Delegate.EndInvoke() being optional. Most of those articles are 4-5 years old. Lots of dead links.
Can anyone explain, in .NET 2.0 - is EndInvoke() indeed preventing an otherwise-inevitable memory leak, and if yes can you please spec...